
356
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Chapter 17HttpResponse Class
17
The HttpResponse Class
Just as the HttpRequest class covered in Chapter 16 is the replacement for the
classic ASP intrinsic Request object, the
HttpResponse class is ASP.NET’s replace-
ment for ASP’s intrinsic Response object. Like the
HttpRequest class, the
HttpResponse class instance for a given ASP.NET page is exposed as a property (the
Response property) of the
Page class (from which all pages are derived), so code for
the
HttpResponse class is the same as in classic ASP. For those of you with classic
ASP applications that migrate to ASP.NET, this class will save you a lot of work.
The
HttpResponse class controls a variety of factors related to ASP.NET’s response
to a given HTTP request and provides access to the output stream of the response,
allowing the writing of text or binary content to the client browser programmati-
cally. The
HttpResponse class provides access to this functionality through its
properties, collections, and methods, which are shown in Table 17-1.
The control over page output that the
HttpResponse class provides includes the
character set used and encoding of the response, as well as whether the response
is buffered and sent all at once (the default) or sent as output is processed.
Methods of the
HttpResponse class provide granular ...