How to force state server to throw away all sessions?
asp.net, iis, session, session-cookies
Solution
Ok, So it seems so (after a bit of experimenting), that restarting of the session state server throw away all data in the session.
The users still have their session ID valid after restart though, which got me originally thinking that the session is not thrown away.
I guess that if the session id sent from a user is not assigned to some existing session, than it is reused for the new one, so user still operates with the same id. Nevertheless, the data in session are cleared.
Problem
I have an asp.net web app which uses state server to store its sessions. When we change a type of something which is stored in the session, all users with active sessions got error, beacuse the "old session" contains insrtances of "old type". I thought that the simplest way to overcome this problem would be to restart the state server, therefor get rid of all sessions. However, this was proffed to be a naive approach. Sessions seems to be still active (users with session old cookie are still capable of working). Is there some other way to force the session state server throw away all sessions, so that old users will be assigned new session? It is ok if they would be forced to authenticate again. Or is there some other (better) way of abandoning all sessions? Ideally not programmaticaly, but something our admin could do? Programmatical approach woudl be maybe calling `Session.RemoveAll` in `Application_End` would solve the issue, bu is this standard approach? Where are session stored in state server if not in memory (which should cease to exist on restart)? I have found two SO questions which are relevant: Clear all sessions on application start - this is rather incomplete programmatical solution How to clear SQL session state for all users in ASP.NET - this is exactly what I would needed if I had had an sql server approach of storing of session data