Results.RedirectToRoute 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.
Overloads
RedirectToRoute(String, RouteValueDictionary, Boolean, Boolean, String) |
Redirects to the specified route.
|
RedirectToRoute(String, Object, Boolean, Boolean, String) |
Redirects to the specified route.
|
RedirectToRoute(String, RouteValueDictionary, Boolean, Boolean, String)
- Source:
- Results.cs
Redirects to the specified route.
- 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. - Otherwise, configures Status302Found.
public static Microsoft.AspNetCore.Http.IResult RedirectToRoute (string? routeName, Microsoft.AspNetCore.Routing.RouteValueDictionary? routeValues, bool permanent = false, bool preserveMethod = false, string? fragment = default);
static member RedirectToRoute : string * Microsoft.AspNetCore.Routing.RouteValueDictionary * bool * bool * string -> Microsoft.AspNetCore.Http.IResult
Public Shared Function RedirectToRoute (routeName As String, routeValues As RouteValueDictionary, Optional permanent As Boolean = false, Optional preserveMethod As Boolean = false, Optional fragment As String = Nothing) As IResult
Parameters
- routeName
- String
The name of the route.
- routeValues
- RouteValueDictionary
The parameters for a route.
- 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.
- fragment
- String
The fragment to add to the URL.
Returns
The created IResult for the response.
Applies to
RedirectToRoute(String, Object, Boolean, Boolean, String)
- Source:
- Results.cs
Redirects to the specified route.
- 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. - Otherwise, configures Status302Found.
public static Microsoft.AspNetCore.Http.IResult RedirectToRoute (string? routeName = default, object? routeValues = default, bool permanent = false, bool preserveMethod = false, string? fragment = default);
static member RedirectToRoute : string * obj * bool * bool * string -> Microsoft.AspNetCore.Http.IResult
Public Shared Function RedirectToRoute (Optional routeName As String = Nothing, Optional routeValues As Object = Nothing, Optional permanent As Boolean = false, Optional preserveMethod As Boolean = false, Optional fragment As String = Nothing) As IResult
Parameters
- routeName
- String
The name of the route.
- routeValues
- Object
The parameters for a route.
- 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.
- fragment
- String
The fragment to add to the URL.
Returns
The created IResult for the response.