





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of state management techniques in asp.net, discussing both client-side and server-side options. Client-side management includes view state, control state, hidden fields, cookies, and query strings. Server-side management options consist of application state, session state, profile properties, and database support. The functionality and best practices of each method.
Typology: Slides
1 / 29
This page cannot be seen from the preview
Don't miss anything!






















Client state management options Server state management options
ASP.NET offers two categories of state management Pure client-side statement management Server-side state management
View state Control state Hidden fields Cookies Query strings
The ControlState property allows you to persist information as serialized data The wiring is not automatic You must program the persisted data each round trip The ControlState data is stored in hidden fields
Use the HiddenField control to store persisted data The data is stored in the Value property
It’s simple and requires no server resources
While simple, cookies have disadvantages A cookie can only be 4096 bytes in size Most browsers restrict the total number of cookies per site Users can refuse to accept cookies so don’t try to use them to store critical information
Use the Response.Cookies collection to reference a cookie Value contains the cookie’s value Expires contains the cookie’s expiration date Cookies can also store multiple values using subkeys Similar to a QueryString It’s possible to restrict cookie scope by setting the Path property to a folder
Application state Session state Profile properties Database support
HttpApplicationState applies to your entire application HttpSessionState applies to the interaction between a user’s browser session and your application
Page caching also relates to state management
The AllKeys property returns an array of strings containing all of the keys Count gets the number of objects in the collection Item provides read/write access to the collection
StaticObjects returns a reference to objects declared in the global.asax file tags with the scope set to Application The Add method adds a new value to the collection The Remove method removes the value associated with a key
Memory to store application state information is permanently allocated You must write explicit code to release that memory So don’t try to persist too much application state information
The Cache object, discussed later, provides alternatives to storing application state information
It’s a way to permanently store user-specific data Data is saved to a programmer-defined data store It takes quite a bit of programming The whole thing is unique to windows