Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 17, 2012 06:07 AM by narenderrawal007
Jan 03, 2012 01:12 PM|LINK
I have a web application in which I have used session variable to store the information. Now we are migrating the application to multiple server kind of environment. So I need to know how we can achieve that. I have heard something like "webstate" can help
in this scenario and I am not new in asp.net but I am fairly new to this term(may be a multiple server thing which I have no idea), All I have known so far is session, cookies,cache, query string,viewstate and some others that asp.net support.
and I am thinking of using query string for passing infromation while navigating between pages and store that information into view state for each page which will be available during postbacks as well.
Can anyone please guide how I can retain the information across multiple servers and what problems I am likely to face and how am I proceeding?
Jan 03, 2012 01:20 PM|LINK
You would need to change the Session mode from "InProc" to either StateServer or SqlServer.
For an overview of Session State modes, see this article: http://msdn.microsoft.com/en-us/library/ms178586.aspx
For a session state server, check out Windows Server AppFabric, a high-performance in-memory cache that also can serve as a Session State Provider for ASP.NET: http://msdn.microsoft.com/en-us/windowsserver/ee695849
Jan 03, 2012 01:24 PM|LINK
For what you have described, the session state need to be reviewed. You are moving to a web farm environment, and the session object used to run in-process in a standalone web server setup need to be serializable. Other methods of persisting data for the
web user should be able to keep the way it is.
There is a comparison of technology that persisting data:
Just make sure you are not storing sensitive information on the client.
Jan 03, 2012 01:42 PM|LINK
Thanks both for your Quick replies. I understand these options are to keep the code for session as is. Could you please tell me
1. Is there something like "webstate" which can help in this scenario ?
I am unsure if its viewstate what is being referred here.
2. Is my solution(mix of query string + viewstate) any good in this scenario ?
3. Just making changes in Web.config(for session state) would be enough to move to new environment ?
I understand that your approach seems to be best solution. I search net and found everyone focussing on changing session state in multiple server scenario.
Jan 03, 2012 02:44 PM|LINK
The nature of the web is stateless, there is no magic "webstate". That's why there are various solution to overcome this stateless behavior of web.
ViewState is basically a hidden value, but with some modifications to prevent average user reading the data out of it. However, it can still be decrypted, and it also increases the page size.
QueryString is clearly defined in the URL, and different browsers have different char limits on how long the URL they can handle. Definitely not suitable for storing large size data.
Both ViewState and QueryString are not suitable to store sensitive data.
To change the session state provider from in-proc to state-server, you need to verify that types of your session objects are all serializable. If they are ALL of string types, then you are in luck, otherwise, you need to verify each object type making sure
they are all serializable. There are cases such as potential circular reference scenario apply to the object is very difficult to serialize. Hence, changing the setting in the web.config is just a trivial step in the migration to state-server based solution.
Jan 04, 2012 06:29 AM|LINK
Thanks very much for help!
Jan 17, 2012 06:07 AM|LINK
I discovered that Webstate is actually an internal implementation here which the people are referring to. A standard approach for storing the state on to a sql server table for sessions.