TypedResults.LocalRedirect(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.
Redirects to the specified localUrl
.
- When
permanent
andpreserveMethod
are set, sets the Status308PermanentRedirect status code. - When
preserveMethod
is set, sets the Status307TemporaryRedirect status code. - When
permanent
is set, sets the Status301MovedPermanently status code.
public static Microsoft.AspNetCore.Http.HttpResults.RedirectHttpResult LocalRedirect (string localUrl, bool permanent = false, bool preserveMethod = false);
static member LocalRedirect : string * bool * bool -> Microsoft.AspNetCore.Http.HttpResults.RedirectHttpResult
Public Shared Function LocalRedirect (localUrl As String, Optional permanent As Boolean = false, Optional preserveMethod As Boolean = false) As RedirectHttpResult
Parameters
- localUrl
- String
The local URL to redirect to.
- permanent
- Boolean
Specifies whether the redirect should be permanent (301) or temporary (302).
- preserveMethod
- Boolean
If set to true, make the temporary redirect (307) or permanent redirect (308) preserve the initial request method.
Returns
The created RedirectHttpResult for the response.