Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

ASP.Net auto logut

We have a AsP.Net web site
Uses a MasterPage
VB Code...

How is the best way to log a person out after 15 minutes inactive

and redirect to Login.aspx
Avatar of Dorababu M
Dorababu M
Flag of India image

I am not sure this works I have this code written long time back in 2012

IdleTimeOut1.rar
ASKER CERTIFIED SOLUTION
Avatar of Dorababu M
Dorababu M
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can just set the settings in your global.asax file.

protected void Application_BeginRequest()
{    Response.Headers.Add("Refresh", Convert.ToString(Session.Timeout * 15)); }

Open in new window

Or
refresh the page to login page after session timeout in page-load event.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
Response.AppendHeader("Refresh", ((Session.Timeout * 60) + 5).ToString() + "; Url=login.aspx");
}

Open in new window