learntechnology
asked on
Session Timeout Warn & redirect to login page
Hi All,
I'm expecting a solution in the asp.net to warn the user before the session expires due to the inactivity and still the session is inactive then it should redirect to login page. Please help me in implementing the solution.
SessionExpired-MessageWindow.PNG
I'm expecting a solution in the asp.net to warn the user before the session expires due to the inactivity and still the session is inactive then it should redirect to login page. Please help me in implementing the solution.
SessionExpired-MessageWindow.PNG
Session.Timeout and Forms.Authentication.Timeo ut are two different animals, for these things to work as intended, both need to be in synch.
Alan
' Get the current Forms.Authentication.Timeout as a timespan
' The amount of time in minutes after which the authentication expires.
Dim currentFormsTimeout As System.TimeSpan = FormsAuthentication.Timeout
' Synch session timeout and forms timeout
Session.Timeout = currentFormsTimeout.TotalMinutes
Then you can use something like this Preventing Session Timeouts in C# ASP .NET to extend the timeout period.Alan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for learntechnology's comment #a38407592
for the following reason:
Since other solutions are not feasible to the requirement. I have implemented the following code after thorough analysis and testing.<br /><br /><meta http-equiv="refresh&q uot; content="0060; URL=/Account/SessionExpire <wbr />d.aspx" />
Accepted answer: 0 points for learntechnology's comment #a38407592
for the following reason:
Since other solutions are not feasible to the requirement. I have implemented the following code after thorough analysis and testing.<br /><br /><meta http-equiv="refresh&q
ASKER
Since my solution is feasible after testing, i'm comfortable to close this request. If anyone has better solution than this with simple code, i would be happy to accept that solution.
ASKER
Below code redirects to the session expired page if the screen is inactive for 1 minute.
<meta http-equiv="refresh" content="0060; URL=/Account/SessionExpire d.aspx" />
Above code works good after testing.
<meta http-equiv="refresh" content="0060; URL=/Account/SessionExpire
Above code works good after testing.
ASKER
Since my solution is feasible after testing, i'm comfortable to close this request. If anyone has better solution than this with simple code, i would be happy to accept that solution.
You can use "setTimeout" function in javascript. You can set time in milliseconds. After that time the message will be prompted.
Open in new window