Amit's Blog

Sharing Thoughts and Learning

  Home  |   Contact  |   Syndication    |   Login
  43 Posts | 1 Stories | 153 Comments | 14 Trackbacks

News

About Me?
Read it in
Blog Statistics
Proud Member of

Archives

Post Categories

Articles

Book Review

I Visit.

OpenSource Project(s)

While visiting Asp.net forum I found a lot of request on how to show a different page when the asp.net session expires. The following line will exactly do the same:

HttpContext.Current.Response.AppendHeader("Refresh", Convert.ToString(((HttpContext.Current.Session.Timeout * 60) - 5)) + "; Url=YOUR PAGE WHICH YOU WANT TO SHOW");

It simply injects a meta data which refresh the pages in the client side. If you are using any master page you can add this line in the PreRender event

kick it on DotNetKicks.com

posted on Saturday, June 09, 2007 12:58 AM

Feedback

# Show a Page when Asp.net session expires 6/9/2007 1:07 AM DotNetKicks.com
You've been kicked (a good thing) - Trackback from DotNetKicks.com

# Links (6/10/2007) 6/11/2007 7:25 AM Member Blogs
.NET IEnumerable and Yield in .NET 2.0 PowerShell: Defining Guids Being Ignorant with LINQ to SQL - in

# re: Redirects to a different page when Asp.net session expires 6/19/2007 7:21 AM Osvaldo Pontes
nice tip!... it solves a problem here

keep up the great job

thanks

# re: Redirects to a different page when Asp.net session expires 7/11/2007 10:26 PM Shahar Nechmad
Great!!
I've been looking for something like this for so long...
Keep posting to your blog. It is one of the best ASP.NET Ajax I've seen.

# re: Redirects to a different page when Asp.net session expires 7/11/2007 11:24 PM Kazi Manzur Rashid
Thanks for your inspiring comment.

# re: Redirects to a different page when Asp.net session expires 10/10/2007 6:15 PM EL FIGHA
choukrane (thank you in)
this solved a great problem for me

# re: Redirects to a different page when Asp.net session expires 11/13/2007 2:26 AM Nuk Chitchulaon
Wow... thanks a bunch for a great tip. It works for me :-)

# re: Redirects to a different page when Asp.net session expires 1/2/2008 10:35 PM Kayani
Hello,
I could not understand this code; can someone guide me where to put this code and how it works. I need to add it on every page or in Global file. I want to add same feature in my ASP.Net (VB.Net) web application. Thanks in advance

Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: 
Please add 3 and 2 and type the answer here: