.net state management
a new instance of the web page class is created each time the page is posted to the server.
In traditional web programming , this would typically mean that all information associated with the page and the controls on the page would be lost with ech round trip.
To overcome this inherent limilation of traditional web programming, asp.net includes several options that help you preserve data on both a pre-page basis and an application-wide basis.
they are : view state; control state; hiddent fields; cookies; query strings; appliation stats; session; profile properties.
here are options which is client-based state:
1. view state:this is the default method that the page uses to preserve page and control property values between round trips. when the page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field, a multiple hiddent fields. when the page is posted back to the server, the page parses the view-state string at page initialization and restores property information in the page. you can also use view state to store information of the page.
2. control state: use view state to store control-state data in order for a control to work properly. eg. you develop a customer control and there three tabs show different information, so the control needs to know which tab is selected between round trips. you can use view state to store this control state.
it's recommanded that the viewstate can be turned off at a page level by a developer.
3.Hidden Fields
a hidden field control which is renders as a standard html hiddent field. when a page is submitted to the server, the content of a hiddent fields is sent in the http from collection along with the values of other controls. do not store any sensitive information in hidden fields.
4.Cookies: is a small month of data this is stored either in a text file on the client file system or in-memory in the client browser session. it contains site-specific infomation that the server sends to the client along with the page output. Cookies can be temporary or persistent.
The cookies are saved on the client device, and when the browser requests a page, the client sends the information in the cookie along with the request information. The server can read the cookie and extract its value. A tyical use is to store a token indicating that the user has already been authenticated in your application.
5.query string : use url to send info from one page to another . eg. www.samplewebpage.com?key1= value1 & key2=value2.
Server-based state:
1. application state
application is global storage mechanism that is accessible from all pages in the web application. application state is stored in a key/value dictionary that is created during each request to a specific url.
2 session state
it is scoped to the current browser session. if different users are using your application, each user session will have a different session state.In addition, if a user leaves your application and then returns later, the second user session will have a diiferent session state from the first.
3profile properties