473,411 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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

Rod
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


Nov 18 '05 #1
3 1667
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
jo*********@gmx.net
Nov 18 '05 #2
Rod
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" <jo*********@gmx.net> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
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
jo*********@gmx.net

Nov 18 '05 #3
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.)

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Thompson | last post by:
Looking for a book to help me develop a philosophy for building databases (particularly on MySQL). And then taking them from concept to construction. Something like.... Start by asking which...
11
by: Robert Schuldenfrei | last post by:
I am an older person trying to learn C# just for the fun of it. I am a veteran of older style languages (COBOL, FORTRAN, etc.) and I want to learn an Object Orientated language. Currently working...
6
by: Jon Shemitz | last post by:
My 16 yo son is ready to move beyond level editing and "Multimedia Fusion." He's going to ignore his Mom's suggestion of Visual Basic, and take my suggestion of starting with C#. Now, I actually...
2
by: cwbp17 | last post by:
I'm having trouble running the MSDN program called CuttingEdge0404.exe at the following site: http://msdn.microsoft.com/msdnmag/issues/04/04/CuttingEdge/default.aspx What has to be done in...
17
by: Happy Man | last post by:
Truth Seeker http://www.thisistruth.org/truth.php?f=TruthSeeker No one is compelled to accept the truth, but it is certainly a shame upon the human intellect when a man is not even...
7
by: simonZ | last post by:
I would like to buy a book with some windows application example in C# net , but all books I have found are only about theory. I would like to have a book, where is explained how to create...
263
by: Malcolm McLean | last post by:
The webpages for my new book are now up and running. The book, Basic Algorithms, describes many of the fundamental algorithms used in practical programming, with a bias towards graphics. It...
126
by: jacob navia | last post by:
Buffer overflows are a fact of life, and, more specifically, a fact of C. All is not lost however. In the book "Value Range Analysis of C programs" Axel Simon tries to establish a...
76
by: lorlarz | last post by:
Crockford's JavaScript, The Good Parts (a book review). This shall perhaps be the world's shortest book review (for one of the world's shortests books). I like Douglas Crockford (because I am a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.