
Page | 665
UI Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Page
System.Web.UI (system.web.dll)
disposable
class
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 apart-
ment (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 perfor-
mance significantly).
Most Page methods are used by the ASP.NET framework and will never be used in your ...