niceguy971
asked on
Sessionstate mode =SQLServer
I have in web-config: <sessionState mode="sql server" ..>
I tried the code below but line { string cookieHeader = Request.Headers["Cookie"]; }
gives me an Error. Is it related to the fact that sessionState mode is Sql server??
If so how can I modify the below code to check if session is expired when sessionState mode="sql server" ??
I found the below info at http://forums.asp.net/t/1138444.aspx. It shows how to check if session is expired
protected void Page_Load()
{
if (Context.Session != null)
{
if (Session.IsNewSession)
{
string cookieHeader = Request.Headers["Cookie"];
if ((null != cookieHeader) && (cookieHeader.IndexOf("ASP .NET_Sessi onId") >= 0))
{
Response.Redirect("session Timeout.ht m");
}
}
}
}
Thanks
I tried the code below but line { string cookieHeader = Request.Headers["Cookie"];
gives me an Error. Is it related to the fact that sessionState mode is Sql server??
If so how can I modify the below code to check if session is expired when sessionState mode="sql server" ??
I found the below info at http://forums.asp.net/t/1138444.aspx. It shows how to check if session is expired
protected void Page_Load()
{
if (Context.Session != null)
{
if (Session.IsNewSession)
{
string cookieHeader = Request.Headers["Cookie"];
if ((null != cookieHeader) && (cookieHeader.IndexOf("ASP
{
Response.Redirect("session
}
}
}
}
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think you can remove the
if ((null != cookieHeader) && (cookieHeader.IndexOf("ASP .NET_Sessi onId") >= 0))
condition and see if it redirects correctly.
if ((null != cookieHeader) && (cookieHeader.IndexOf("ASP
condition and see if it redirects correctly.
ASKER
Thanks
ASKER
The expression { null != cookieHeader } returns true;
but cookieHeader.IndexOf("ASP.
(null != cookieHeader) && (cookieHeader.IndexOf("ASP
and line Response.Redirect("session
How can I modify the code to check if session is expired when sessionState mode="sql server" ??
Thanks