Abandon Session on Browser Close or Browsing Away
Posted on 2011-02-11
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()?