HttpResponseWrapper.RedirectPermanent Method

Definition

Performs a permanent redirect from a requested URL to the 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.

C#
public override void RedirectPermanent(string url, bool endResponse);

Parameters

url
String

The URL to redirect the request to.

endResponse
Boolean

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

Exceptions

url is null.

url includes a newline character (\n).

Remarks

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

RedirectPermanent(String)

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

C#
public override void RedirectPermanent(string url);

Parameters

url
String

The URL to redirect the request to.

Exceptions

url is null.

url includes a newline character (\n).

Remarks

The RedirectPermanent(String) method overload provides a 301 HTTP status code in the response and also 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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1