Last post Mar 16, 2012 12:53 PM by DMW
Mar 16, 2012 11:09 AM|itman1981|LINK
In a Web farm (a group of more than one Web server),
you could run the state service on any single server or on a separate machine entirely.
Now i want to know if state service in running on different machine then how the user session are send to the browser
for example in process model( server use cookie to identified user) but in out process is a webservice(running on different machine then how the user will be identified.
Mar 16, 2012 12:53 PM|DMW|LINK
1. Client sends in the session id as part of the request (normally via a cookie)
2. Session module (it's an HttpModule) picks out the session id and makes a network request to retrieve the session data from the session server. The data from this request is then associated with the current request (via the HttpContext Session property,
which you will gain access to via the Session property on your aspx page).
3. Handler (so, your ASP.NET page) does what it does to handle the incoming request and render output to the response stream. It has acccess to the Session object because of the previous step.
4. Session module sends the updated session data back to the session server
There's one important subtle thing to note here. The cost of steps 2 and 4 can be quite high, which is why ASP.NET doesn't do steps 2 and 4 for a request unless the handler says it requires session state (it does this with a couple of marker interfaces,
IReadOnlySessionState (turn on step 2) and IRequiresSessionState (turn on step 2 and 4). In aspx pages, these are turned on by using EnableSessionState, and they can be turned on in web.config as well.