
480
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Chapter 23System.Web Namespace
23
The System.Web Namespace
The System.Web namespace contains some of the fundamental ingredients for ASP.
NET applications. These ingredients include the classes used for the original built-in
ASP objects (Request, Response, Application, and Server), as well as classes for managing
cookies, configuring page caching, implementing tracing, and retrieving information
about the web server and client browser. Aside from the classes required for web
services and the Web Forms user interface, the System.Web namespace contains the
heart of ASP.NET’s functionality. Figures 23-1 and 23-2 show the types in this
namespace.
One confusing aspect about the System.Web namespace is Microsoft’s “all roads lead
to Rome” approach to backward compatibility. For example, the HttpRequest class
can be accessed on a Web Form through the Page class (Page.Request), the HttpContext
class (Page.Context.Request), and the HttpApplication class (Page.Context.ApplicationInstance.
Request). In all cases, the reference is pointing to the same object. Essentially, the
HttpContext class encapsulates the fundamental types that relate to an HTTP request.
The HttpContext object is made available to all IHttpModule and IHttpHandler instances
(which includes HttpApplication, System.Web.UI.Page ...