Skip to content
November 10, 2010 / kiranpatils

Session values lost when any exception occurs


If you’ve stored some values in session and your session values getting lost when any exception occurs. Then this article may provide you hint to solve it.


In my case the reason was as below:

Basically I was creating a directory under my web root directory and when any exception occurred I was deleting that directory. And that was the main reason for losing my session values.

So, Now I am creating/deleting directory outside my web root directory and problem is solved!

And deepest reason is Application Restart – Whenever any directory gets created/deleted under web root ASP.NET restarts the application pool. To read more about ASP.NET Application restart read my blog post.

Happy Coding! 🙂




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: