Login or Sign Up to become a member!

EXPERTS, INFORMATION, IDEAS & KNOWLEDGE

Social bookmarker Add this

ASP.NET: Redirect the page when the session ends

From Wiki

Jump to: navigation, search

Summary: A simple way of redirecting the user to a certain page when their session ends.

Here's a simple method, without using javascript, to redirect the user to a certain page once their session ends:

  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.     If Not Page.IsPostBack Then
  3.         Response.AppendHeader("Refresh", (Session.Timeout * 60) + 5 & "; Url=SessionEnded.aspx")
  4.     End If
  5. End Sub


This Hack is part of the ASP.NET Hacks collection

465 Rating: 4.6/5 (5 votes cast)