Wednesday, 28 December 2011

State Management in Asp.Net

State Management in Asp.Net


Why state Management is important?
Web Pages developed in ASP.Net are HTTP based and HTTP protocol is a stateless protocol so web page is a stateless, which means that it is not capable of storing any information by itself. Because whenever a request for a web page comes from the client, by post-back of a web page the same page will not be returned to the client after processing. So all information associated with the page and the controls on the page would be lost with each round trip. Web server does not have any idea about the requests from where they coming means from same client or new clients. On each request web pages are created and destroyed.

Example of a stateless webpage is that a user is filling its online bank registration form and by mistake it fills some wrong information and after click on submit button its returned back due to invalid information, on this stage user would lost its whole filled information which he was filling from last one hour. So this kind of situations makes the need of State Management of a web page.

Solution of the above problem lies in State Management.

State management is the process by which you maintain state and page information over multiple requests for the same or different pages. ASP.Net technology offers following state management techniques.


Types of State Management in Asp.Net:

Client side state Management: View state, control state, hidden fields, cookies, and query strings all involve storing data on the client in various ways.
View state

Control state

Hidden fields

Cookies

Query strings


Server side state Management: application state, session state, and profile properties all store data in memory on the server. Each option has distinct advantages and disadvantages, depending on the scenario.
Session State

Application State

Profile Properties

No comments:

Post a Comment