編輯

共用方式為


HttpResponseBase.RedirectPermanent Method

Definition

Performs a permanent redirect from the requested URL to a specified URL.

Overloads

RedirectPermanent(String, Boolean)

Performs a permanent redirect from the requested URL to the specified URL, and provides the option to complete the response.

RedirectPermanent(String)

Performs a permanent redirect from the requested URL to the specified URL.

RedirectPermanent(String, Boolean)

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)

Parameters

url
String

The location to which the request is redirected.

endResponse
Boolean

true to terminate the response; otherwise false. The default is false.

Exceptions

Remarks

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. 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.

Applies to

RedirectPermanent(String)

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)

Parameters

url
String

The location to which the request is redirected.

Exceptions

Remarks

The RedirectPermanent(String) method overload provides a 301 HTTP status code in the response and includes the URL to redirect the request to. 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.

Calling the RedirectPermanent(String) method terminates the rest of the response.

Applies to