Last post Jan 23, 2020 04:55 PM by mgebhard
Jan 23, 2020 04:21 PM|Bholz97|LINK
I am working on an ASP.Net web forms application.
I want the site to timeout after a certain period, which should be simple, however, I cannot seem to get this to happen as expected.
I have tried changing the timeout settings in web.config, as well as in IIS. I am in SQLServer Session Mode.
Code written in the Session_End function of the Global.asax file never executes, regardless of what settings I use for timeout.
Examining the session cookie and ASPStateTempSessions table in SQL Server indicate that the settings that I am changing in web.config are indeed changing the timeout values of the session, however, there is never anything to suggest that the site is ACTUALLY
I do not know where else to look for timeout settings, or what may be preventing me from generating a timeout.
Jan 23, 2020 04:29 PM|mgebhard|LINK
ASP.NET does not timeout. Are you referring to user Session timeout? Are using SQL to store Session? If so, SQL Server mode does not trigger the Session_End. The InPorc mode does to clear server memory otherwise the app will eventually run out of memory.
SQL server mode does not have this issue. You can certainly set the Session timeout which will expire the Session cookie.
sqlConnectionString="data source=127.0.0.1;user id=<username>;password=<strongpassword>"
Jan 23, 2020 04:36 PM|Bholz97|LINK
Thank you for your response!
Yes, I am referring to user session timeout. Apologies, I am relatively new to this.
If SQL Server Mode does not trigger Session_End, then what would be your recommended strategy to redirect to a different page upon session timeout?
Jan 23, 2020 04:55 PM|mgebhard|LINK
Just check if the Session variable is empty.
if(Session["TheVariable"] == null)
Place the code in your master page Page_Load event. If you are not using master page then use the Application_AcquireRequestState or a later event in the Global.asax.