Friday, February 11, 2011

How to Automatically Redirects to LoginPage when Session Timeout

Hi friends,We already know sessions plays a very important role in the WebApplications.In this i would like to explain how to Redirect the page when sessions timeout.


just write the following code in the page from which page you would like to redirect

protected void Page_Load(object sender, EventArgs e)
    {
        string ToRedirectURL = "sessionpage.aspx";
        Response.AppendHeader("REFRESH", "20;URL=" + ToRedirectURL);
    }
After the 20 seconds the page will be redirects to session page as shown below in the figure




You can directly redirects to Loginpage or sessionPage...




That's it..If You Have any doubts please feel free to ask me i will always ready to help you
developercode
About the Author
Sayyad is a Software Engineer, Blogger and Founder of Developers Code from India.His articles mainly focus on .Net (Web and Windows based applications), Mobile Technologies (Android,IPhone,BlackBerry) and SEO.

Labels: , , , , ,

4 Comments:

At April 25, 2011 at 7:49 PM , Anonymous Anonymous said...

super...its working fine

 
At April 25, 2011 at 7:49 PM , Anonymous Neo bru said...

rock..........

 
At April 25, 2011 at 7:50 PM , Anonymous Anonymous said...

Thanks for sharing taanu.......

 
At September 19, 2013 at 3:52 PM , Anonymous Anonymous said...

thanks

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home