custom errors...

  • Thread starter Thread starter bill yeager
  • Start date Start date
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>
 
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.
 
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.
 
Back
Top