HttpResponse.RedirectLocation HttpResponse.RedirectLocation HttpResponse.RedirectLocation HttpResponse.RedirectLocation Property

定义

获取或设置 HTTP Location 标头的值。Gets or sets the value of the HTTP Location header.

public:
 property System::String ^ RedirectLocation { System::String ^ get(); void set(System::String ^ value); };
public string RedirectLocation { get; set; }
member this.RedirectLocation : string with get, set
Public Property RedirectLocation As String

属性值

通过 HTTP Location 标头传输到客户端的绝对 URI。The absolute URI that is transmitted to the client in the HTTP Location header.

异常

已编写 HTTP 标头。The HTTP headers have already been written.

示例

下面的示例演示如何使用此属性来指定在通过使用 HTTP 301 响应代码对永久重定向进行编码时的重定向 URL。The following example shows how to use this property to specify the redirect URL when you code a permanent redirect by using the HTTP 301 response code.

Response.StatusCode = 301;  
Response.Status = "301 Moved Permanently";  
Response.RedirectLocation = "http://www.newurl.com ";  
Response.End();  

适用于