ASP.NET管理状态的十种途径

HTTP协议是无状态的,ASP.NET提供了丰富的手段在页面之间管理状态。本文列举ASP.NET管理状态的十种途径。    ASP.NET中,从System.Web.UI.Page继承的类里有以下十种管理页面状态的途径:
    1.  Application对象: this.Application
    2.  Session对象: this.Session
    3.  Cookie对象: this.Request.Cookies
    4.  查询字符串: this.Request.QueryString
    5.  Form变量和Hidden变量: this.Request.Params
    6.  Cache对象: this.Cache
    7.  ViewState对象: this.ViewState
    8.  HttpContext对象: this.Context.Handler及this.Context.Items
    9.  静态对象: 任何static类或static类成员
    10. Web.config配置节: ConfigurationSettings.AppSettings.