What are the root cause to loss the session values in ASP.NET applications?
Cause 1: Session will expire in InProc session state
Yes, Session will lost the values in InProc session state when the Web garden(IIS) value is greater than 1.
Why? InProc session management won’t work because each worker process will be maintaining its own session state. So if the user is browsing your Web site and if we have 2 worker processors, then your user has a 1 in 2 chance of losing his session state as IIS round-robins his subsequent requests among the 2 available worker processes. If you use an out-of-process session state, then we can be sure that all 2 worker processes are consulting the same single resource as the place to store and retrieve session data.
How to check the Web garden value in my IIS server?
I. First we need to start the IIS Manager.
We can use two ways to start the Internet Information Services Manager..
From the Start menu, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
To start IIS Manager from the Run dialog box
1. From the Start menu, click Run.
2. In the Open box, type inetmgr, and click OK.
II. Check the Web garden settings
In IIS Manger just expand the local computer, expand Application Pools, right click the application pool, and then click Properties.
Click the Performance tab, and under Web garden settings check the Maximum number of worker processes value is 1 or greater than 1
If the value is greater than 1, Please change the value to 1 in order to fix this cause.