Redirect after session timeout
How do you redirect the user to the login page after session timeout? Thanks
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted Apr 26, 2011, 6:45 AM EDT
Use above in Page_Init().
Suthish NairRank #92 · 22.8K reputationPosted Apr 26, 2011, 6:50 AM EDT
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);
}
}
}
Felipe RamosRank #1,409 · 1.2K reputationPosted Apr 26, 2011, 5:12 PM EDT