
Comments/Troubleshooting | 357
HttpResponse
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Comments/Troubleshooting
The Response object provides control over both the format of the output sent to
the browser and the content. In fact, an ASP.NET page can be written with no
static HTML content whatsoever, and can generate that content exclusively
through calls to the properties and methods of the response object, if desired. This
provides the ability to programmatically generate not just HTML output dynami-
cally, but any output the browser is capable of displaying, including image
content and XML. This generation allows ASP.NET to be incredibly flexible in its
response to user actions.
In classic ASP, the Response object’s Write method was often used for quick and
dirty debugging, such as to display a message indicating that a certain point in a
page was reached or to display the value of variables used within the page. This
simple and effective debugging technique had one major flaw: frequently, these
calls to Response.Write were left in a page that was moved from a development
server to a production server, resulting in end users seeing the debugging
message—hardly a desirable outcome. In ASP.NET, the new Trace object (a prop-
erty of the
Page class) provides the ability to write messages to a central trace log
rather than to