ResponseExtensions.Redirect(HttpResponse, String, Boolean, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for