
382
|
Chapter 17: The HttpResponse Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Parameters
url
A String argument containing the URL for the page to redirect to.
endResponse
A Boolean argument indicating whether to terminate processing of the
current page. If the argument is omitted, the method call causes processing of
the current page to be discontinued.
Example
The example redirects the current request to BufferOutput.aspx and directs
ASP.NET to discontinue processing of the current page:
Sub Page_Load( )
Response.Redirect("BufferOutput.aspx", True)
End Sub
Notes
Unless additional processing needs to be done in the page from which you call
Response.Redirect, you should always pass
True as the second argument to
Response.Redirect to prevent server resources from being wasted by continuing to
process the current page. This feature is new for ASP.NET. When calling
Response.Redirect with only the
url argument, processing of the current page is
discontinued automatically.
Note that when redirecting to a page such as BufferOutput.aspx in which buff-
ering is turned off, or to a page that calls Response.Flush, the redirect will not
complete until the target page has completed processing. This means that all
content on the target page will be seen at once, rather than as it is rendered or
flushed from the buffer.
Write
Response.Write(ByVal ...