ResponseExtensions.Redirect(HttpResponse, String, Boolean, Boolean) Method

Definition

Returns a redirect response (HTTP 301, HTTP 302, HTTP 307 or HTTP 308) to the client.

public:
[System::Runtime::CompilerServices::Extension]
 static void Redirect(Microsoft::AspNetCore::Http::HttpResponse ^ response, System::String ^ location, bool permanent, bool preserveMethod);
public static void Redirect (this Microsoft.AspNetCore.Http.HttpResponse response, string location, bool permanent, bool preserveMethod);
static member Redirect : Microsoft.AspNetCore.Http.HttpResponse * string * bool * bool -> unit
<Extension()>
Public Sub Redirect (response As HttpResponse, location As String, permanent As Boolean, preserveMethod As Boolean)

Parameters

response
HttpResponse

The HttpResponse to redirect.

location
String

The URL to redirect the client to. This must be properly encoded for use in http headers where only ASCII characters are allowed.

permanent
Boolean

True if the redirect is permanent (301 or 308), otherwise false (302 or 307).

preserveMethod
Boolean

True if the redirect needs to reuse the method and body (308 or 307), otherwise false (301 or 302).

Applies to