Home All Groups Group Topic Archive Search About

Problems with Session.IsNewSession - Please Help

Author
14 Dec 2006 1:27 PM
rsouza
Hi.

Recently here in my work we added the following code in the Global.asax
file to handled the session expired and redirect users to the home of
the site explaining them the occurred (some thing like "Your session
has expired, please restart your navigation.").

public void Session_Start(Object sender, EventArgs e) {

      if(Session.IsNewSession && Request.Headers["Cookie"] != null &&
         Request.Headers["Cookie"].IndexOf("ASP.NET_SessionId") >= 0)
      {
         Response.Redirect("/index.aspx?timeout=1");
         // when the param "timeout" exists in the url the user
receives the message "... Session expired ..."
      }

}

In our tests the code above works fine, but now sometimes we open the
browser, type the url address of the site and the message "... session
expired ..." appears. This occurs just in some machines and not all the
times we access the site.

Someone knows what is happening??

Thanks

Rodrigo

Author
14 Dec 2006 5:34 PM
Gabriel Lozano-Morán
My guess is that some clients have cookie support where others don't?

Show quote
"rsouza" <rodrigo***@gmail.com> wrote in message
news:1166102864.979554.206650@j72g2000cwa.googlegroups.com...
> Hi.
>
> Recently here in my work we added the following code in the Global.asax
> file to handled the session expired and redirect users to the home of
> the site explaining them the occurred (some thing like "Your session
> has expired, please restart your navigation.").
>
> public void Session_Start(Object sender, EventArgs e) {
>
>      if(Session.IsNewSession && Request.Headers["Cookie"] != null &&
>         Request.Headers["Cookie"].IndexOf("ASP.NET_SessionId") >= 0)
>      {
>         Response.Redirect("/index.aspx?timeout=1");
>         // when the param "timeout" exists in the url the user
> receives the message "... Session expired ..."
>      }
>
> }
>
> In our tests the code above works fine, but now sometimes we open the
> browser, type the url address of the site and the message "... session
> expired ..." appears. This occurs just in some machines and not all the
> times we access the site.
>
> Someone knows what is happening??
>
> Thanks
>
> Rodrigo
>

AddThis Social Bookmark Button