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?
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.
bo0ga
Member
16 Points
104 Posts
How to get the current date time when a session ends
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?
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: How to get the current date time when a session ends
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?
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
bo0ga
Member
16 Points
104 Posts
Re: How to get the current date time when a session ends
Nov 26, 2012 01:57 PM|LINK
Just done and close the browser
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: How to get the current date time when a session ends
Nov 26, 2012 02:28 PM|LINK
This is a very hard problem to solve. I don't have a failsafe solution for you.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
pratiksolank...
Member
270 Points
73 Posts
Re: How to get the current date time when a session ends
Nov 26, 2012 07:22 PM|LINK
Hi,
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.
Regards,
Pratik