From: Ele on
Hello,

I have an ASP.NET (C#) website. The session length is set to 20 minutes.

In this website there is an .aspx page (in an IFRAME) that gets
automatically reloaded (using a javascript timer) every 5 minutes. However,
I noted that using this approach the session never expires, even when the
user is away from his computer (because the IFRAME page always refreshes the
session). Instead, I need that the session expires after 20 minutes.

So I started looking at creating a page that does not update the Session
"timer" and found I had to use "EnableSessionState = False" in the @page
directtive of the .aspx page that gets reloaded every 5 minutes. However, it
does not seem to work, because the session does not expire after 20 minutes.

So the question is: how can I create a page that does not refresh the
session?
Thanks!


From: Brian Cryer on
"Ele" <nospam(a)nospam.com> wrote in message
news:4c74d634$0$19000$4fafbaef(a)reader5.news.tin.it...
> Hello,
>
> I have an ASP.NET (C#) website. The session length is set to 20 minutes.
>
> In this website there is an .aspx page (in an IFRAME) that gets
> automatically reloaded (using a javascript timer) every 5 minutes.
> However, I noted that using this approach the session never expires, even
> when the user is away from his computer (because the IFRAME page always
> refreshes the session). Instead, I need that the session expires after 20
> minutes.
>
> So I started looking at creating a page that does not update the Session
> "timer" and found I had to use "EnableSessionState = False" in the @page
> directtive of the .aspx page that gets reloaded every 5 minutes. However,
> it does not seem to work, because the session does not expire after 20
> minutes.

Is there anything on your page (or being called by your page) which uses
session information? I would GUESS that if you refer to session and the
session isn't loaded that its loaded on demand at that point - but this is
just a GUESS.

> So the question is: how can I create a page that does not refresh the
> session?
> Thanks!

A different approach, if you want the session to expire then does this mean
that you want the page to stop updating after say 20 minutes? If so you
could count the number of times the page has refreshed (possibly by adding a
parameter to the refresh url), and simply stop refreshing once you've
reached your desired limit. I know this isn't the same as using the session
timeout, but it might do the trick.

Hope this helps.
--
Brian Cryer
http://www.cryer.co.uk/brian