Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 26, 2012 07:22 PM by pratiksolanki
Nov 26, 2012 12:43 AM|LINK
I want the current date time added to my database when the user exits out of the website. I'm guessing the session ends when they exit out? How do I do this?
Nov 26, 2012 01:22 AM|LINK
Well, depends. Do you mean session state, login session or they just are done with your app and close the browser?
Nov 26, 2012 01:57 PM|LINK
Just done and close the browser
Nov 26, 2012 02:28 PM|LINK
This is a very hard problem to solve. I don't have a failsafe solution for you.
Nov 26, 2012 07:22 PM|LINK
Seession time out apply only when user has logged into the website. To record datetime into the database add your DB update code into the Global.ascx page in the "Session_End" event
void Session_End(object sender, EventArgs e)
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
Alternatively, you can setup Session time out page / login time out page (TimeOut.aspx) into the WebConfig file and on the pageload event of TimeOut.aspx page run your DB code to record date and time.
<forms loginUrl="Timeout.aspx" timeout="20" />