the problem is that i cannot access the Session veriable in the
Application_BeginRequest(Object sender, EventArgs e) method.
When i run the project the Global.aspx does not compile and show an show
the following error
Exception Details: System.Web.HttpException: Session state is not available
in this context.
Line 55: protected void Application_BeginRequest(Object sender, EventArgs
e)
Line 56: {
Line 57: if(Session["memberID"] == null)
Line 58: {
Then where can u do this check if i cannot do it in that method?
francois
"Antoni Massó Mola" <am****@triliumsoftware.com> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
Try this:
if(Session["memberID"] == null)
{
Response.Redirect("redirectpage.aspx");
}
"francois" <fr******@bettinghouses.com_NOSPAM> wrote in message
news:Of*************@TK2MSFTNGP09.phx.gbl... Hi,
I would like to redirect the user to the login page after the session
time out.
I tried to do a trick in the global.aspx.cs
protected void Application_BeginRequest(Object sender, EventArgs e)
{
object obj = Session["memberId"];
if (obj == null)
{
// do redirect
}
}
But it says that the Session object cannot be called in that context.
My goal is that I am trying to check at each request if the session
object i stored in my Session is still existing or not. If not, it means the
session is timed out and that i need to log in again and go back to the log in
page.
Thanks for any help
Francois