HttpResponseWrapper.RedirectPermanent 方法

定義

永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirect from a requested URL to the specified URL.

多載

RedirectPermanent(String, Boolean)

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

RedirectPermanent(String)

永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirect from the requested URL to the specified URL.

RedirectPermanent(String, Boolean)

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

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

參數

url
String

要求將重新導向至其中的 URL。The URL 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 also includes the URL to redirect the request to. 這個方法多載會提供選項來指定是否要終止回應,或在執行重新導向之後完成。This method overload provides the option to specify whether to terminate the response or to complete it after the redirect has been performed. 301 HTTP 狀態碼是 HTTP 回應中的標準程式碼。A 301 HTTP status code is a standard code in an HTTP response. 它指出永久重新導向存在,而且它會提供重新導向的位置。It indicates that a permanent redirect exists, and it provides the redirect location.

適用於

RedirectPermanent(String)

永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirect from the requested URL to the specified URL.

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

參數

url
String

要求將重新導向至其中的 URL。The URL 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 also 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 redirect exists, and it provides the redirect location.

呼叫 RedirectPermanent(String) 方法會終止回應的其餘部分。Calling the RedirectPermanent(String) method terminates the rest of the response.

適用於