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.
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.
Amit ChoudharyPosted Jul 27, 2010, 9:48 AM
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 SoniPosted Jul 27, 2010, 9:39 AM
if ( Session["username"] == null )
{
Response.Redirect("login.aspx");
}