Click to See Complete Forum and Search --> : Sessions


Suzi167
October 15th, 2006, 11:02 PM
I have an application which uses session variables to store user name and log in to a SQL Database and everything works fine.

My question is when the session expires and I try to open the SQL Connection which exception exactly occurs so I can handle it in code.

SQLException does not seem to catch it.

Thanks!

Suzi

AlanGRutter
October 15th, 2006, 11:32 PM
AFAIK there is not a specific exception to indicate an expired session. When you try to open a session object that has expired it will not exist and you will probably get a NullRefenceException.

regards
Alan

Suzi167
October 16th, 2006, 09:08 AM
Thanks for the advice!

I will try to include that in my catch clause.

Susan

Niranos
October 23rd, 2006, 02:51 PM
Hi

It’s not quite true, You can set session expiation time in web.config file.


<system.web>
<sessionState mode="StateServer" timeout="6" />
</system.web>


And AlanGRutter Has right, when you will try to open a session object that has expired or not exist You will get a NullRefenceException.

More about Session State You can read
http://msdn2.microsoft.com/en-us/library/ms178586.aspx