ASP.NET State Management: Client and Server Techniques, Slides of Computer Programming

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

2012/2013

Uploaded on 09/27/2013

vikrant
vikrant 🇮🇳

4.4

(9)

119 documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASP.NET State
Management
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download ASP.NET State Management: Client and Server Techniques and more Slides Computer Programming in PDF only on Docsity!

ASP.NET State

Management

Lecture Overview

 Client state management options  Server state management options

Types of State Management

 ASP.NET offers two categories of state management  Pure client-side statement management  Server-side state management

Client State Management

(Introduction)

 View state  Control state  Hidden fields  Cookies  Query strings

State Management

( ControlState )

 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

State Management

(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

Cookie Limitations

 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

Cookies Members

 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

Server State Management

Options

 Application state  Session state  Profile properties  Database support

Server State Management

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 HttpApplicationState

Class (Members 1)

 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

The HttpApplicationState

Class (Members 2)

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

Application State

(Best Practices)

 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

Profile Properties

 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