Using Request and Response ASP.NET is a redesigned and re-engineered evolution of ASP. Several metaphors from ASP were carried over to ASP.NET (although their implementations might be vastly different). Two such objects are the Request and Response introduced in the System.Web.UI.UserControl class. These objects also exist in the System.Web.UI.Page class. The Request object is an instance of the HttpRequest class, and the Response object is an instance of the HttpResponse class. Basically, Request represents the HTTP values sent by the client, and Response represents the information sent by the server application back to the client. We use the Request and Response relative to the properties and methods their classes expose and their respective roles. When you need specific information about a client request in your code, get that information from the Request object. The parallel is true for the Response object. From Listing 19.1 it is apparent that we can use the Response.Write method to render HTML directly on the page (see line 26 of Listing 19.1). |
Team-Fly |
Top |