HttpResponse.Redirect Method (String)
This page is specific to:.NET Framework Version:1.1
.NET Framework Class Library
HttpResponse.Redirect Method (String)

Redirects a client to a new URL and specifies the new URL.

[Visual Basic]
Overloads Public Sub Redirect( _
   ByVal url As String _
)
[C#]
public void Redirect(
 string url
);
[C++]
public: void Redirect(
 String* url
);
[JScript]
public function Redirect(
   url : String
);

Parameters

url
The target location.

Exceptions

Exception Type Condition
HttpException A redirection is attempted after the HTTP headers have been sent.

Remarks

Redirect calls End which raises a ThreadAbortException exception upon completion.

Example

The following example forces an unconditional redirection to another Web site.

[Visual Basic] 
Response.Redirect("http://www.microsoft.com/gohere/look.htm")
   

[C#] 
Response.Redirect("http://www.microsoft.com/gohere/look.htm");
   

[C++] 
Response->Redirect(S"http://www.microsoft.com/gohere/look.htm");
   

[JScript] 
Response.Redirect("http://www.microsoft.com/gohere/look.htm")
   

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpResponse Class | HttpResponse Members | System.Web Namespace | HttpResponse.Redirect Overload List

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View