I have a simple web service, in it i have a static class which has a static collection to remember alive tokens.
I just want to make sure that the token collection lives until the next iisreset or the application pool recycles.
And what is the difference between remembering states in Application bag and static class?
Thanks,
Microsoft (says):
ASP.NET includes application state primarily for compatibility with classic ASP so that it is easier to migrate existing applications to ASP.NET. It is recommended that you store data in static members of the application class instead of in the Application object. This increases performance because you can access a static variable faster than you can access an item in the Application dictionary.
So, use static variables. And do not forget use lock
.
Your static members won't scale to more than 1 server.