i store some information in my website (mvc3-.net4-iis7) by this syntax:
HttpContext.Current.Application.Add(appKey, value);
and read data by this one:
HttpContext.Current.Application[appKey];
it works fine but after a short time (about 20 minutes) it works not and can not find [appKey],i want to know
has it some setting to do or has it expire time?
i change my cookie expire time to 7 days in my web.config but not working yet.
thanks for your helping
Those values are stored in-memory. If the application gets recycled by IIS, the AppDomain goes down and everything you have stored in memory is lost. Don’t forget that IIS could recycle your application at any moment. For example if certain memory/CPU thresholds are met. So if you attempt to read the value without setting it after the application has been recycled it won’t be there.
So you should consider using a more persistent place to store this information rather than storing it in-memory.
Values that you store in the application state have nothing to do with cookies. They are stored on the server.