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
Web DevelopmentASP.NET.NET Programming

Avatar of undefined
Last Comment
David H.H.Lee
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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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






.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo