All Web Forms you create for an ASP.NET application derive implicitly
or explicitly from Page. This class, which is a
special subclass of Control, adds additional
page-specific functionality. For example, rather than simply
providing the Control.Context property, the
Page class provides the traditional built-in
objects through references like Response,
Request, and Application. The
Page class also provides properties that allow you
to use tracing (Trace and
TraceEnabled) and access all the validation
controls and information about whether their validation was
successful (Validators and
IsValid).
Another useful property is IsPostBack, which you
can test in the Load event. Typically, you will
skip control initialization if this property returns
True, indicating that the page has already been
displayed and the control values will be persisted in view state. You
can also set AspCompatMode to
True so the Page will be
executed on a single-threaded apartment (STA) thread. This setting
allows the page to call other STA components, such as those you may
have developed with Visual Basic 6 (although it can hamper
performance significantly).
Most Page methods are used by the ASP.NET
framework and will never be used in your code. One exception is
MapPath( ), which returns the physical path on the
server that corresponds to a specified virtual path (URL).
public class Page : TemplateControl, System.Web.IHttpHandler {
// Public Constructors
public Page( );
// Protected Static Fields
protected const string postEventArgumentID; // =_ _EVENTARGUMENT
protected const string postEventSourceID; // =_ _EVENTTARGET
// Public Instance Properties
public HttpApplicationState Application{get; }
public Cache Cache{get; }
public string ClientTarget{set; get; }
public override bool EnableViewState{set; get; } // overrides Control
public string ErrorPage{set; get; }
public override string ID{set; get; } // overrides Control
public bool IsPostBack{get; }
public bool IsReusable{get; } // implements System.Web.IHttpHandler
public bool IsValid{get; }
public HttpRequest Request{get; }
public HttpResponse Response{get; }
public HttpServerUtility Server{get; }
public virtual HttpSessionState Session{get; }
public bool SmartNavigation{set; get; }
public TraceContext Trace{get; }
public IPrincipal User{get; }
public ValidatorCollection Validators{get; }
public string ViewStateUserKey{set; get; }
public override bool Visible{set; get; } // overrides Control
// Protected Instance Properties
protected bool AspCompatMode{set; }
protected bool Buffer{set; }
protected int CodePage{set; }
protected string ContentType{set; }
protected override HttpContext Context{get; } // overrides Control
protected string Culture{set; }
protected bool EnableViewStateMac{set; get; }
protected ArrayList FileDependencies{set; }
protected int LCID{set; }
protected string ResponseEncoding{set; }
protected bool TraceEnabled{set; }
protected TraceMode TraceModeValue{set; }
protected int TransactionMode{set; }
protected string UICulture{set; }
// Public Instance Methods
public void DesignerInitialize( );
public string GetPostBackClientEvent(Control control, string argument);
public string GetPostBackClientHyperlink(Control control, string argument);
public string GetPostBackEventReference(Control control);
public string GetPostBackEventReference(Control control, string argument);
public virtual int GetTypeHashCode( );
public bool IsClientScriptBlockRegistered(string key);
public bool IsStartupScriptRegistered(string key);
public string MapPath(string virtualPath);
public void ProcessRequest(System.Web.HttpContext context); // implements System.Web.IHttpHandler
public void RegisterArrayDeclaration(string arrayName, string arrayValue);
public virtual void RegisterClientScriptBlock(string key, string script);
public virtual void RegisterHiddenField(string hiddenFieldName, string hiddenFieldInitialValue);
public void RegisterOnSubmitStatement(string key, string script);
public void RegisterRequiresPostBack(Control control);
public virtual void RegisterRequiresRaiseEvent(IPostBackEventHandler control);
public virtual void RegisterStartupScript(string key, string script);
public void RegisterViewStateHandler( );
public virtual void Validate( );
public virtual void VerifyRenderingInServerForm(Control control);
// Protected Instance Methods
protected IAsyncResult AspCompatBeginProcessRequest(System.Web.HttpContext context,
AsyncCallback cb, object extraData);
protected void AspCompatEndProcessRequest(IAsyncResult result);
protected virtual HtmlTextWriter CreateHtmlTextWriter(System.IO.TextWriter tw);
protected virtual NameValueCollection DeterminePostBackMode( );
protected virtual void InitOutputCache(int duration, string varyByHeader, string varyByCustom,
OutputCacheLocation location, string varyByParam);
protected virtual object LoadPageStateFromPersistenceMedium( );
protected virtual void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument);
protected virtual void SavePageStateToPersistenceMedium(object viewState);
}