Link to home
Start Free TrialLog in
Avatar of rito1
rito1

asked on

Abandon Session on Browser Close or Browsing Away

HI All,

When a user logs into my website is creates the Session variable UserID.

When the user logs out using the logout button, I call Session.Abandon() which in turn calls Session_End() within my Global.asax file. This function uses the UserID variable and performs a transaction against my database.

this works really well proving the user uses the damn logout button! But what I am finding is that users are either browsing away from the site or closing their browser down which isn't then performing that all important transaction against my database.

Does anyone have any magic code which can check for users browsing away or browser closing which in turn maintains the session variable whilst calling Session_End()?

Many thanks,

Rit

SOLUTION
Avatar of karthitron
karthitron
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rito1
rito1

ASKER

Thanks both.

B_levitt, I tried to rely on Session Timeout but I want to use the session variable which didn't seem to persist long enough for the global.asax Session_End event when a browser is closed.
I'm not sure what you mean that the session variable didn't seem to persist long enough.

Either way does the link I pasted answer your question?
Avatar of rito1

ASKER

Thanks Both, - b_levitt, thanks for the link.

Rit