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?
To help others, don't forget to mark the post as answer if it answered your question.
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.
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.
To help others, don't forget to mark the post as answer if it answered your question.
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.
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.
To help others, don't forget to mark the post as answer if it answered your question.
narenderrawa...
Member
646 Points
223 Posts
How to retain information across multiple servers ?
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?
DarrellNorto...
All-Star
86809 Points
9646 Posts
Moderator
MVP
Re: How to retain information across multiple servers ?
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
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
jackyang
Contributor
5816 Points
782 Posts
Re: How to retain information across multiple servers ?
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: http://msdn.microsoft.com/en-us/magazine/cc300437.aspx
Just make sure you are not storing sensitive information on the client.
.NET Developer
ASP.NET/jQuery Spell Checker
narenderrawa...
Member
646 Points
223 Posts
Re: How to retain information across multiple servers ?
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.
jackyang
Contributor
5816 Points
782 Posts
Re: How to retain information across multiple servers ?
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.
.NET Developer
ASP.NET/jQuery Spell Checker
narenderrawa...
Member
646 Points
223 Posts
Re: How to retain information across multiple servers ?
Jan 04, 2012 06:29 AM|LINK
Thanks very much for help!
narenderrawa...
Member
646 Points
223 Posts
Re: How to retain information across multiple servers ?
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.