If you have one web server, and you used the default InProc mode for the duration of SessionState, then any data that you added to the session dictionary in your server code will be lost when you reuse the application pool - after transcoding, when your code the next one accesses the entry in the SessionState dictionary, it will return null .
Similarly, this will happen if you have several web servers in the load balancer, the session state is incorrectly configured as InProc , and the user returns to another server (i.e. without sticky routing).
(The session state cookie stored in the browser may remain valid for several minutes).
A way to allow the session state to "survive" the reboot of the application pool, server crash, or going through the server farm is to save the data stored in SessionState so that the server (or servers) can retrieve the data when the user session returns. The easiest way is to use one of the solutions from the box , namely a separate StateServer process or save the state in the SqlServer database. User persistence is also an option.
One warning - note that any data stored in "off-process" mode, such as StateServer or SqlServer , must be serializable - this may be a change when disconnected from InProc .
source share