Visual Studio .NET - Display a message Page has expired

Asked By Ralph Acido on 10-Sep-06 09:14 PM
Hello! i just want to know how to display a message Page has expired and other information why his session expires... after his session expires it will displayn that message automatically... thanks!
Sushila Patel replied to Ralph Acido on 10-Sep-06 11:19 PM

You can check for session Variable value and then display message if Session variable value is null


you can do as follows - Venkat K replied to Ralph Acido on 11-Sep-06 12:20 AM

1..When your user logs in set a session variable, EG:
session("loggedIn") = "y"

2..Then in the head of every page you would like to detect 'are they logged in' place
<%
  if session("loggedIn") <> "y" then
     response.redirect("loginPageName.asp?ses=exp")
  end if
%>

checking session expires or not - K Pravin Kumar Reddy replied to Ralph Acido on 11-Sep-06 12:35 AM

hello

put this code in every page load event

if(session("loggedIn") != null)

{

//here put ur page load code

}

else

{

Response.Redirect("LoginPage.aspx");

}

 

u have to put this code in all pages page_load event those pages u can only access after loging only...

coz some information need to removed from memory so that session expires will occur for 20 min defalut u can chage that in web.config file..