Generally, while using web page data will be lost while transferring control from one page to another. To maintain data that you had used in previous page, we use State Management Techniques. Nowadays, all web application demand high level state management. In this article, we will discuss about state management technique and their types in ASP.net. Web pages are based on stateless HTTP protocol which does not retain data while transferring control from one page to another. This means all information associated with the page or control on another page would be lost. There are many techniques we can use to maintain data. There are two type of state management Client side and server side state management.
In client side state management, it store information in either in client computer or web page. No information will be stored in server side in round trip. Round Trips means specific information is send to server and server will respond back to client machine. Technique used to store information in client sides are:
View state: View state is one of the main client side state management techniques to store data in client data. View state provides page level state management. In ASP.net application, when user wants to store data temporarily after post back. Until user is on current page state is available when user redirect to next page current page state is lost.
Hidden field: It can store small amount of data which change frequently like single value data. Hidden form field is page specific information or can store information only for single page which does not render data in web browser. It is invisible in browser.
Cookies: It can also store small amount of user information either in text file or in client system. Cookies are used for identification of user. But it contains site specific information. Whenever user makes a request for a page the first time, server immediately creates a cookie in client machine permanently (Persistent) or temporarily (Non-Persistent).
Query string: Query string used to hold information from one page and send to different page. It can easily navigate from one page to another using URL. Query string provides simple but limited way of maintaining some state information.
Working of client side and server side are same but in server side all information is stored in user memory. For storing web page information in more secure place then server side state management is more secure the client side state management.
Session state: Session provide a strong technique to maintain state. It is used to store user information or unique id of user by using session. Session state object is created from the HttpSessionState class. ASP.net allows you to save value using session state and data can be accessible from all pages of request by single web browser in current session.
Application state: It is server side state management technique. Application state uses instance of HttpApplicationState class. Application state is global storage mechanism that is accessible from all pages of web application. Application state is stored in value that is created during each request to specific URL.
for more info : cpd-india
Batches: Regular & Weekends for Working Profession
For FREE DEMO CLASS CALL – 011-65164822 / 91- 8860352748
CPD Technologies Block C 9/8, Sector -7, Rohini, Delhi-110085, India Landmark: Near Rohini East Metro Station, Opposite Metro Pillar No-397
Website :- www.cpd-india.com
Email :- email@example.com