Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > In Esposito's book, what's the purpose of going to session_expired.aspx?

Reply
Thread Tools

In Esposito's book, what's the purpose of going to session_expired.aspx?

 
 
Rod
Guest
Posts: n/a
 
      09-24-2004
In Dino Esposito's book, "Programming Microsoft ASP.NET", there is a chapter
titled, "ASP.NET State Management". There is a section in there discussing
session state sometimes going away. He mentions that in version 1.1 of
ASP.NET, that it isn't possible for the application to know about the
session expiring. He gives a work around which you can try using that is
put into the Session_Start event, which would first determine if there
exists a cookie called "started_at". If there isn't, then the session was
never started, you create the cookie and then put DateTime.Now into it.



However, if the cookie has been created and you're still executing the
Session_Start event, then the session has expired. His code then does the
following:



Context.Response.Redirect("session_expired.aspx");



Now, I know that the name of the target page isn't important, but what I don
't understand is why he would recommend going to an ASPX page? I would have
thought that you would rather send the user to some HTML page instead. I am
sure I am missing something here, so please enlighten me.



Rod




 
Reply With Quote
 
 
 
 
Joerg Jooss
Guest
Posts: n/a
 
      09-24-2004
Rod wrote:
> In Dino Esposito's book, "Programming Microsoft ASP.NET", there is a
> chapter titled, "ASP.NET State Management". There is a section in
> there discussing session state sometimes going away. He mentions
> that in version 1.1 of ASP.NET, that it isn't possible for the
> application to know about the session expiring. He gives a work
> around which you can try using that is put into the Session_Start
> event, which would first determine if there exists a cookie called
> "started_at". If there isn't, then the session was never started,
> you create the cookie and then put DateTime.Now into it.
>
>
>
> However, if the cookie has been created and you're still executing the
> Session_Start event, then the session has expired. His code then
> does the following:
>
>
>
> Context.Response.Redirect("session_expired.aspx");
>
>
>
> Now, I know that the name of the target page isn't important, but
> what I don 't understand is why he would recommend going to an ASPX
> page? I would have thought that you would rather send the user to
> some HTML page instead. I am sure I am missing something here, so
> please enlighten me.


Why would you expect to redirect only to a static page? Both solutions are
possible.

Cheers,

--
Joerg Jooss
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
 
 
 
Rod
Guest
Posts: n/a
 
      09-27-2004
Mainly because I thought, once the session has expired going to a .ASPX page
with a session ID which is still around, might cause problems.

Or at least, that is what I thought.

Am I wrong about that?

Rod

"Joerg Jooss" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Rod wrote:
>> In Dino Esposito's book, "Programming Microsoft ASP.NET", there is a
>> chapter titled, "ASP.NET State Management". There is a section in
>> there discussing session state sometimes going away. He mentions
>> that in version 1.1 of ASP.NET, that it isn't possible for the
>> application to know about the session expiring. He gives a work
>> around which you can try using that is put into the Session_Start
>> event, which would first determine if there exists a cookie called
>> "started_at". If there isn't, then the session was never started,
>> you create the cookie and then put DateTime.Now into it.
>>
>>
>>
>> However, if the cookie has been created and you're still executing the
>> Session_Start event, then the session has expired. His code then
>> does the following:
>>
>>
>>
>> Context.Response.Redirect("session_expired.aspx");
>>
>>
>>
>> Now, I know that the name of the target page isn't important, but
>> what I don 't understand is why he would recommend going to an ASPX
>> page? I would have thought that you would rather send the user to
>> some HTML page instead. I am sure I am missing something here, so
>> please enlighten me.

>
> Why would you expect to redirect only to a static page? Both solutions are
> possible.
>
> Cheers,
>
> --
> Joerg Jooss
> (E-Mail Removed)
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      09-27-2004
Hi Rod,

I think Both aspx page and static html page are OK. And when Session
Expired, a new one will automatically started. Since we manually check the
expiring in our serverside code, so when we detect the oringal session
state is expired, in fact a new one is already started. There won't be any
problem as long as we don't try to access the old datas wo originally
stored in the SessionState after it expired.
The reason we redirect the user to an aspx page is ASPX page is served by
asp.net runtime and we can do some further serverside tasks there. Also, if
we just want to display some static infos (messages) to the end user, a
static html page is enough. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: Windows XP: Going, going ... gone? OTHMAN MCSE 2 03-25-2008 04:45 PM
XP search going all lame on me..explorer going crazy when trying tosearch. fotoobscura Computer Support 8 01-12-2008 01:09 AM
Firefighters at the site of WTC7 "Move away the building is going to blow up, get back the building is going to blow up." Midex Python 24 05-07-2007 04:23 AM
floppy drive just keeps on going and going and ... Weylon Bulloch Computer Support 1 09-07-2003 07:17 AM
VPN going up but traffic going one way PLP Cisco 1 07-11-2003 08:28 AM



Advertisments