Palmi
Palmi

Reputation: 2521

Is HttpContext.Current.Session shared between worker processes?

In an ASP.NET MVC application is the data in HttpContext.Current.Session shared between all worker processes when number of worker processes is greater than 1 in IIS settings?

Upvotes: 2

Views: 650

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239200

No. Each worker is essentially a different instance of the application, and has it's own HttpContext.Current. If you need to share something like session-state between the workers, then you have to set the application up such that each instance will use the same datastore for the session and be able to encrypt/decrypt the same values from that common store. What this essentially boils down to is setting an explicit machine key in your Web.config.

Upvotes: 3

Related Questions