Name
Redirect
Synopsis
Response.Redirect(ByVal url As String)
Response.Redirect(ByVal url As String, _)
ByVal endResponse As Boolean)
Redirects the currently executing page to another page specified by the URL argument, optionally terminating the processing of the current page.
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 SubNotes
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 buffering 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access