Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Part III: Namespace Reference > The System.Web Namespace

Chapter 22. 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. Figure 22-1 and Figure 22-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, and System.Web.UI.UserControl), and some of its properties are "magically" copied into these classes for convenience and backward compatibility. When you use the built-in Request object on a Web Forms page, for example, you use the Request property from the Page class.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial