Redirect after session timeout
How do you redirect the user to the login page after session timeout? Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Felipe RamosPosted Apr 26, 2011, 9:12 PM
Suthish NairPosted Apr 26, 2011, 10:50 AM
public static void SessionCheck()
{
if (HttpContext.Current.Session("User") == null)
{
HttpContext.Current.Response.Redirect("LoginPage.aspx");
}
else
{
if (string.IsNullOrEmpty(HttpContext.Current.Session("User") + ""))
{
HttpContext.Current.Response.Redirect("LoginPage.aspx", false);
}
}
}
Abhimanyu K VatsaPosted Apr 26, 2011, 10:45 AM
Use above in Page_Init().