HttpResponseBase.RedirectPermanent 方法

定義

執行從要求之 URL 至指定之 URL 的永久重新導向。Performs a permanent redirect from the requested URL to a 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:
 virtual void RedirectPermanent(System::String ^ url, bool endResponse);
public virtual void RedirectPermanent (string url, bool endResponse);
abstract member RedirectPermanent : string * bool -> unit
override this.RedirectPermanent : string * bool -> unit
Public Overridable Sub RedirectPermanent (url As String, endResponse As Boolean)

參數

url
String

重新導向要求的位置。The location to which the request is redirected.

endResponse
Boolean

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

例外狀況

永遠。Always.

備註

多載 RedirectPermanent(String, Boolean) 方法會在回應中提供 301 HTTP 狀態碼,並包含將要求重新導向至的 URL。The RedirectPermanent(String, Boolean) overload method provides a 301 HTTP status code in the response and includes the URL to redirect the request to. 此多載也提供選項,以指定是否要在執行重新導向之後終止或完成回應。This overload also provides the option to specify whether to terminate or to complete the response 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:
 virtual void RedirectPermanent(System::String ^ url);
public virtual void RedirectPermanent (string url);
abstract member RedirectPermanent : string -> unit
override this.RedirectPermanent : string -> unit
Public Overridable Sub RedirectPermanent (url As String)

參數

url
String

重新導向要求的位置。The location to which the request is redirected.

例外狀況

永遠。Always.

備註

方法多載會 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 redirect exists, and it provides the redirect location.

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

適用於