Reputation: 3293
There is a bug in the system I am working on where every so often the users will "lose" the orders they are working on.
I have some code like this
if (System.Web.HttpContext.Current.Session[OrderProductsSessionKey] != null)
{
model =(EditOrderProductsModel)System.Web.HttpContext.Current.Session[OrderProductsSessionKey];
}
I don't see any issues in the logic getting to this area, debugging into the method looks ok and haven't been able to reproduce it yet. My question is, is it possible for these cookies to become corrupt? What would cause something like that and what could be done to prevent it?
Upvotes: 1
Views: 66
Reputation: 13673
How are you storing that session? If you're using in-process storage (ASP.NET default) any application pool restart (recycle) will cause the session to be cleared.
IIS is configured by default to recycle the application pool every so often.
Switching to database or out of process session storage may help. Which of these is best for your application, depends on the type of application and the way it's deployed.
Upvotes: 5