Asp.net State Management
What : Encrypted String stored inhidden field
Where : hidden field in page
How long : page life cycle
Scope : current page
Performance Implication : too muchViewState will increase page Size and slow down page loading
Usage :Page Specific Settings
Limitation :
·When store security data
·Used by multiple pages
·A lot of data need to store
Disable Scenario :
·Control Never change after first time loading
·Each post back rebind data
·Input changes only because of user action (submitform )
(Page Never reach the 2ndtime page render event )
Disable Level :
·Control
·Page
·Web Config -> All Pages
Encryption / Hash :
·ViewState Hash : EnableViewStateMac=”true”
1. Pagelevel
2. WebConfig level
·ViewState Encrypt / Decrypt
1. Pagelevel
2. WebConfig level
What :
some user specific data stored in Server Memory / Sql Server/ State Server
Where :
Worker Process / Sql Server / State Server
How long :
Depends on the settings set in Web Config / Session tag ,default is 20mins
Scope :
Whole Application
Performance implication :
Store amount of information may slow down server / net work
Usage :
Store user specific data
Mode :
·In Proc
1.Store in Application Process
2.Cannot use Web Garden Deploy strategy
3.Default setting
·Sql Server
1.Store in data table
2.More secure
3.Can use inWebGarden Scenario
·State Server
1.Ensure Asp.Net Service is on
2.Store in Asp.net Service and retrieve via TCP/IPprotocol
3.Can use inWebGarden Scenario
·Custom
1.Always suggest to use a 3rd party oneother than create own
SessionID Store Method :
·Cookie (Default)
·URL
When lost Session :
·Close Browser
·Session.Abandon
·20 minutes time up
When Compression :
·Large data storage
·Web Garden Deploy strategy
Other Tips :
·When Expired ,create a new Session Id :
RegeneratedExpiredSession=true
·Force use SSL :
Request.Cookies[“ASP.NET_SessionID”].secure = true
What : key/value datastored in client browser
Where : client browser
How long : depends onthe programmer by setting expired time
Scope : whole application
Performance implication : no .
Usage : Preference of user
What : Object stored in server memory
How long : Application life time, until IIS reboot
Scope : Whole application
Performance implication : not suggest store too much data inapplication level
Usage : Store some application level object
Each application object operation , remember :
·Application lock
·Application unlock
When consider using application object , better consider :
·http module
·Global asax file
What : store some setting in back end db
Where : a back end data base
How long :permanent
Scope :available for multiple applications
Performance implication : high concurrent may slow down dueto R/W to file
Usage :store some customer account information
What : Page object cache
Where : server memory
How long :can set duration
Scope : whole application
Performance implication : depends
Usage :
Cache page data reduce page press
cache data reduce db trip
·Limited length
·Visible to user
·Security reason : can user URL encode/decode
·Usage : pass ID /name (Less data)
·Data not visible
·Data unlimited
·Usage : submit a form
·Set post back URL
·Check PreviousePage.IsCrossPagePostBack : Identify arequest is from another page or not
·Access Previous Page for data needed (from previouspage )
·Validation : PreviousPage.IsValid
·Ask Previous Page for data
·No client request trip
·Remain URL in browser
·Can Remain Query string / Form