Session has expired in ASP.NET

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..

First one,

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

Second option,

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.

IIS Manager

Click the Performance tab, and under Web garden settings check the Maximum number of worker processes value  is 1 or greater than 1

Web garrden settings

If the value is greater than 1, Please change the value to 1 in order to fix this cause.


2 thoughts on “Session has expired in ASP.NET

  1. Pingback: ASP.NET Session Expired error when viewing reports using ReportViewer web control in SSRS 2008 - Question Lounge

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s