I am developin an asp.net application , what i want is i want to redirect to login page form any of the webpage in my appli
when session expires.....or agter session timeout
how to do that
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
Amit ChoudharyRank #145 · 15.8K reputationPosted Jul 27, 2010, 5:48 AM EDT
on page load write code like this:
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Refresh",Convert.ToString((Session.Timeout * 60) + 5));
if(Session.IsNewSession)
Server.Transfer("Relogin.aspx");
}
Please mark 'Do you like this post' if it helps you
Hiren SoniRank #694 · 3.5K reputationPosted Jul 27, 2010, 5:39 AM EDT
if ( Session["username"] == null )
{
Response.Redirect("login.aspx");
}