HttpResponse.RedirectPermanent 方法

定義

執行從要求之 URL 至指定之 URL 的永久重新導向。Performs a permanent redirection from a requested URL to a specified URL.

多載

RedirectPermanent(String, Boolean)

執行從要求之 URL 至指定之 URL 的永久重新導向,並提供完成回應的選項。Performs a permanent redirection from the requested URL to the specified URL, and provides the option to complete the response.

RedirectPermanent(String)

執行從要求之 URL 至指定之 URL 的永久重新導向。Performs a permanent redirection from the requested URL to the specified URL.

RedirectPermanent(String, Boolean)

執行從要求之 URL 至指定之 URL 的永久重新導向,並提供完成回應的選項。Performs a permanent redirection from the requested URL to the specified URL, and provides the option to complete the response.

public:
 void RedirectPermanent(System::String ^ url, bool endResponse);
public void RedirectPermanent (string url, bool endResponse);
member this.RedirectPermanent : string * bool -> unit
Public Sub RedirectPermanent (url As String, endResponse As Boolean)

參數

url
String

要求將重新導向至其中的位置。The location to redirect the request to.

endResponse
Boolean

true 表示終止回應,否則為 falsetrue to terminate the response; otherwise false. 預設為 falseThe default is false.

例外狀況

urlnullurl is null.

url 包含新行字元 (\n)。url includes a newline character (\n).

備註

RedirectPermanent(String, Boolean)方法多載會在回應中提供 301 HTTP 狀態碼,並包含要將要求重新導向至的 URL。The RedirectPermanent(String, Boolean) method overload provides a 301 HTTP status code in the response and includes the URL to redirect the request to. 這個方法多載也會提供選項,以指定是否要在執行重新導向之後終止或完成回應。This method overload also provides the option to specify whether to terminate or to complete the response after the redirection has been performed. 301 HTTP 狀態碼是 HTTP 回應中的標準程式碼。A 301 HTTP status code is a standard code in an HTTP response. 這表示永久重新導向存在,並提供重新導向位置。It indicates that a permanent redirection exists, and it provides the redirection location.

RedirectPermanent(String)

執行從要求之 URL 至指定之 URL 的永久重新導向。Performs a permanent redirection from the requested URL to the specified URL.

public:
 void RedirectPermanent(System::String ^ url);
public void RedirectPermanent (string url);
member this.RedirectPermanent : string -> unit
Public Sub RedirectPermanent (url As String)

參數

url
String

要求將重新導向至其中的位置。The location to redirect the request to.

例外狀況

urlnullurl is null.

url 包含新行字元 (\n)。url includes a newline character (\n).

備註

RedirectPermanent(String)方法多載會在回應中提供 301 HTTP 狀態碼,並包含要將要求重新導向至的 URL。The RedirectPermanent(String) method overload provides a 301 HTTP status code in the response and includes the URL to redirect the request to. 301 HTTP 狀態碼是 HTTP 回應中的標準程式碼。A 301 HTTP status code is a standard code in an HTTP response. 這表示永久重新導向存在,並提供重新導向位置。It indicates that a permanent redirection exists, and it provides the redirection location.

RedirectPermanent(String)呼叫方法多載會終止回應。Calling the RedirectPermanent(String) method overload terminates the response.

適用於