Asp.Net State management
来源:互联网 发布:xbox 360 pc 手柄 mac 编辑:程序博客网 时间:2024/06/07 02:09
Asp.net State Management
State Object
ViewState
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
Session
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
Cookie
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
Application
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
Tips :
Each application object operation , remember :
· Application lock
· Application unlock
When consider using application object , better consider :
· http module
· Global asax file
Profile
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
Cache
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
Transforming data between pages
QueryString
· Limited length
· Visible to user
· Security reason : can user URL encode/decode
· Usage : pass ID /name (Less data)
Form
· Data not visible
· Data unlimited
· Usage : submit a form
CrossPagePostBack
· 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
Server.Transfer
· Ask Previous Page for data
· No client request trip
· Remain URL in browser
· Can Remain Query string / Form
- Asp.Net State management
- High Performance ASP.NET application (1) – Optimizing state management
- ASP.net View State
- ASP.NET State Service
- asp.net state manage
- ASP.net View State
- ASP.net View State
- ASP.NET State Service
- ASP.NET 的Session State
- ASP.NET 的Session State
- ASP.NET 2.0 - Control State
- Asp.net Session State 小记
- ASP.NET Session State FAQ
- Understanding ASP.NET View State
- 启动 ASP.NET State service
- Understanding ASP.NET View State
- Cache Management in ASP.NET
- ASP.NET Session State Partitioning using State Server Load Balancing
- java的4种Reference学习
- python time模块学习
- 不能不提到的,新手建站和新站的优化技巧
- mysql查询缓存
- c++ 提升程序的特权(AdjustTokenPrivileges)
- Asp.Net State management
- MAC安装eclispe和JDK
- 单链表逆置
- iOS 网络请求数据 同步请求、异步请求、GET、POST请求
- linux下删除文件之后,磁盘空间仍然没有释放
- OCP-1Z0-052-V8.02-186题
- 使用maven创建项目
- Struts2——(4)OGNL与struts标签
- Cocos2d-x——CCLabelAtlas (英文艺术文本)