This documentation is archived and is not being maintained.

Page and Application Context in Web Forms Applications

When a Web application runs, ASP.NET maintains information about the current application, about each user session, the current HTTP request, the requested Web Forms page, and so on. The ASP.NET page framework contains a series of classes to encapsulate this context information.

ASP.NET makes instances of these classes available as intrinsic objects that you can access from your code. The following table lists these intrinsic objects and the classes they are instances of.

Note   Although the classes that define these objects are new with ASP.NET, the objects are used in the same way as with previous versions of ASP.
Object NameDescriptionASP.NET Class
ResponseProvides access to the output stream for the current page. You can use this class to inject text into the page, write cookies, and more. For details, see Page.Response Property.HttpResponse
RequestProvides access to the current page request, including the request headers, cookies, client certificate, query string, and so on. You can use this class to read what the browser has sent. For details, see Page.Request Property.HttpRequest
ContextProvides access to the entire current context (including the request object). You can use this class to share information between pages.HttpContext
ServerExposes utility methods that you can use to transfer control between pages, get information about the most recent error, encode and decode HTML text, and more.HttpServerUtility
ApplicationProvides access to application-wide methods and events for all sessions. Also provides access to an application-wide cache you can use to store information. For details, see Application State.HttpApplicationState
SessionProvides information to the current user session. Also provides access to a session-wide cache you can use to store information, along with the means to control how the session is managed. For details, see Session State.HttpSessionState
TraceProvides a way to get both system and custom trace diagnostic messages to display in the HTTP page output. For details, see ASP.NET Trace.TraceContext

The following topics show examples of how the intrinsic objects can be used.

See Also

Introduction to Web Forms State Management | ASP.NET State Management