NetTalk Central

Author Topic: Delete record when browse is closed  (Read 5612 times)

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Delete record when browse is closed
« on: November 14, 2012, 02:06:35 PM »
I have a site that users have to login and when they logout a particular record as to be deleted, so i was using the session deleted to delete this record when they logout but in some suitation when they just close browser without logging out i need to delete the record and i have put a timeout on sessions and try and delete after timeout deletes session but that seems not to work . The only way is when they logout.
Please anybody on how i can solve this problem.

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Delete record when browse is closed
« Reply #1 on: November 14, 2012, 02:33:21 PM »
"try and delete after timeout deletes session"

> try just before the session is deleted.

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Delete record when browse is closed
« Reply #2 on: November 14, 2012, 03:31:22 PM »
hi kevin, which embed point do i use i have tried delete session embed point in the webhandler and that seems not to do the trick

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Delete record when browse is closed
« Reply #3 on: November 14, 2012, 10:03:12 PM »
that's the right place - WebHandler, DeleteSession -
just make sure you do it before the parent call.

cheers
Bruce

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Delete record when browse is closed
« Reply #4 on: November 15, 2012, 03:37:09 AM »
Hi,

I can confirm that when a user just Close the Browser, the record is not deleted (in my instance In-Memory files with SessionID are not cleared), even if it is before the Parent Call as per Bruce. The time-out and logging off does work.

I guess I did not bring this up before as Session ID's are anyway so Unique I am only affected by the list of 'Users Currently Online'.

[Well, let me rephrase, when you Close the Browser it does NOT happen immediately.  Ok, I checked now, as for the In-Memory driver the clean-up does happen later, I guess when the time-out happens.]

Cheers
Charl
« Last Edit: November 15, 2012, 04:25:39 AM by charl99 »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Delete record when browse is closed
« Reply #5 on: November 15, 2012, 07:04:43 AM »
nothing happens when the user closes the browser - that's kinda the point.

So the session times out sometime after that (15 minutes by default) and the DeleteSession method is called at that time.

cheers
Bruce

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Delete record when browse is closed
« Reply #6 on: November 15, 2012, 07:43:09 AM »
Hi bruce,
     I agree with Charl after the timeout time it still does not work, but from the weblog it says delete session but the delete session embed point does not trap the event that the session has been deleted. And i have put it just before the parent call, even added a message which never gets trigger unless i logout properly.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Delete record when browse is closed
« Reply #7 on: November 15, 2012, 11:30:44 PM »
Hi Olu,

I'm not seeing the same thing mate, sorry.
I took example 1, and added the following line of code just before the parent call in the p_web.DeleteSession method;

  self._trace('IN DELETE SESSION ' & self.SessionId)

Then I set the session timeout to 1 minute (just to speed things up a bit).

Lastly I connected to the server from a browser fiddled around a bit, then just did nothing.

After a minute passed I clicked on the server window (not in the browser) just to trigger an event. (The Session cleanup requires an event, but usually there are plenty of events flowing as other people access the site.)

In debugview I got the following line;

[4296] [netTrace][thread=3] IN DELETE SESSION 7QfzKxkHRtFOYNY7XiydRQ7pjU8OZA

So I guess, if you are having a problem, I'll need to see some sort of example app.

cheers
Bruce


olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Delete record when browse is closed
« Reply #8 on: November 16, 2012, 09:43:15 AM »
Hi Bruce,
   willit be because my application is been dll been hosted on the mutisite site host program?

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Delete record when browse is closed
« Reply #9 on: December 04, 2012, 02:34:50 AM »
Hi Bruce,
    Yes it works if i run the program on its own but when i run it as a dll using the multihost, in other words runing mutiple sites then it stops working