Tutorial :Need education regarding HttpApplicationState of ASP.net



Question:

Today I've got confused with 2 issues related to the HttpApplicationState of ASP.net. My questions are as follows

  1. If I use a StateServer for my session management (the out proc session management stuff that I want to use for my web garden deployment), is it safe assuming that the HttpApplicationState (I am accessing via System.Web.UI.Page.Application property) is also stored inside the StateServer just as Session? So if my workerprocess A writes a value "10" into the Page.Application, another request running in workerprocess B at some point later must see this "10" for the same key- is it correct?

  2. One of my fellow developer told me that he found in his test, in a StateServer scenario, if he has 100 key-value entries inserted into the Page.Session then when he tries to read any of the key from a different request, the workerprocess brings the entire 100 entries into the active workerprocess memory space and then serves the key that was actually asked by the request. is it true?

It would be greatly appreciate if someone could help me to remove my confusions on this regard.

Thanks!


Solution:1

  1. StateServer supports Session state only, Application state is limited to the AppDomain.

  2. The StateServer stores a serialisation of a Session. It has no way to know how access a specific key value. When accessed the session is re-hydrated into the application requiring it and is used as normal session data for the duration of the request.


Solution:2

  1. As far as I know the out of process state server does not store HttpApplicationState data. You could test this easily to be sure, but I doubt that it does.

  2. I don't think this is true either. The session store is basically a hashtable. Looking up a single key in a hashtable should only return the associated value. You shouldn't see the behaviour you describe. Again, you should be able to test this easily.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »