custom errors...

B

bill yeager

Could someone please tell me what the status code is for a
session timeout?

I want to redirect the user to a specific page informing
them that their session has timed out and they need to log
back in again.

I want to set up a custom error in the web.config file
based on this error, but I don't know what the error code
is.

Something like:
<customErrors mode="RemoteOnly"
defaultRedirect="/error.html">
<error statusCode="403" redirect="/accessdenied.html" />
<error statusCode="404" redirect="/pagenotfound.html" />
</customErrors>
 
M

Marina

A session timeout isn't an error. The client just gets a new session when a
request is made and the old session is no longer available. The error you
would get is in your code, when a session variable you expect isn't there -
but that is just a nullreferenceexception.

You could have your pages check the IsNewSession property of the session
object to check if this session just got created, if that helps.
 
K

Kevin Spencer

There's no status code, but if you chack any object stored in Session to see
if it is null, you will know.

Due to the timeout issue, one should always check objects in Session for
null whenever referencing them, in order to avoid NullReferenceExceptions.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top