How is session handled for multiple instances of a web application

Posted on 2012-09-17
Medium Priority
Last Modified: 2012-09-18
Suppose I have a web application and it has a session variable named "Customer"
So Session["Customer"] = QueryStringValue;

if I have multiple instances of the web application running. Will the value for
 Session["Customer]  be different in each instance of the application running (I would hope so).

Or would their be a conflic where session variables are being overwritten by the other web application running?
Question by:brgdotnet
LVL 21

Accepted Solution

Dale Burrell earned 280 total points
ID: 38408081
Session values are unique per session???

A session is a single browser connected to the site, so if you connect to the site from you computer using 2 different browsers you have 2 sessions open, and any session variables you store are unique within the single session they are stored in.

When you say multiple instances of the web application, are you saying you are running the site multiple times? Or you have assigned multiple worker processes to the same site?

One thing you do have to be careful of is if you assign multiple worker processes to the same site you have to ensure your session handler can be accessed from all work processes because different requests within the same session could go to a different worker process.

Same thing applies with a web farm.


Assisted Solution

sameer_goyal earned 280 total points
ID: 38408289
I assume when you say "if I have multiple instances of the web application running.", you mean you have different browsers or browser windows open to access the web application on the client?

Is that correct?

if yes, then yes, you can be rest assured that the Session["Customer"] will be unique for each session that is created for each browser window.

How it works, it that for each browser request, the web server generates a unqiue Session Id and the tracks the communciation using that. Hence, it is gauranteed to be unique.

This is however, not true, if you are using different tabs within the same browser window.

In that case, your session will be re-used for each tab.

Hope that helps.

Assisted Solution

sarabhai earned 280 total points
ID: 38408661
take look at
Session variable are maintain separately for each user on a web application so defiantly maintain separately for more than one instance of web application.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question