Last post Mar 23, 2012 06:59 PM by hj
Mar 23, 2012 05:09 PM|justin9|LINK
Redirect to Login page on session time out.
Hi I have an application where I want the user to redirect to login page after the session times out.
Currently the application pool has a default idle time out of 20 minutes.
And I added the following in the web config
<sessionState mode="InProc" cookieless="false" timeout="1" />
<forms name="CTEPSafety" timeout="1" loginUrl="Login.aspx" />
Do I need to add anything in the global.asax
The error I’m having is after 20 minutes the application is allowing the user to edit the data on the page they are on, but only when they try to navigate to a different page then it gets redirected to login.aspx.
How can I make sure that the application redirects to login page after the user has been idle for 20 minutes.
I’m kinda new so thanks for your help
Mar 23, 2012 05:45 PM|Ashutosh Pathak|LINK
In Session_End method of global.asax write line below:
Mar 23, 2012 06:37 PM|justin9|LINK
Im getting the following error - Response is not available in this context.
Mar 23, 2012 06:59 PM|hj|LINK
var timeOut = 1000; //based on miliseconds
what is happening is that after the timeout the webpage is submited to your server side code and since the session is ended it'll redirect your user to the login page.
there is also much easier soution which i havn't tested yet so i don't know the issues that are involved with using it and that's a meta tag with keyword equal to "referesh" and the content equal to your time out.