Table of Contents

Class RedirectToRouteResult

Namespace
System.Web.Http.Results
Assembly
System.Web.Http.dll

Represents an action result that performs route generation and returns a <see cref="F:System.Net.HttpStatusCode.Redirect"/> response.

public class RedirectToRouteResult : IHttpActionResult
Inheritance
RedirectToRouteResult
Implements
Inherited Members

Constructors

RedirectToRouteResult(string, IDictionary<string, object>, ApiController)

Initializes a new instance of the <see cref="T:System.Web.Http.Results.RedirectToRouteResult"/> class with the values provided.

public RedirectToRouteResult(string routeName, IDictionary<string, object> routeValues, ApiController controller)

Parameters

routeName string

The name of the route to use for generating the URL.

routeValues IDictionary<string, object>

The route data to use for generating the URL.

controller ApiController

The controller from which to obtain the dependencies needed for execution.

RedirectToRouteResult(string, IDictionary<string, object>, UrlHelper, HttpRequestMessage)

Initializes a new instance of the <see cref="T:System.Web.Http.Results.RedirectToRouteResult"/> class with the values provided.

public RedirectToRouteResult(string routeName, IDictionary<string, object> routeValues, UrlHelper urlFactory, HttpRequestMessage request)

Parameters

routeName string

The name of the route to use for generating the URL.

routeValues IDictionary<string, object>

The route data to use for generating the URL.

urlFactory UrlHelper

The factory to use to generate the route URL.

request HttpRequestMessage

The request message which led to this result.

Properties

Request

Gets the request message which led to this result.

public HttpRequestMessage Request { get; }

Property Value

HttpRequestMessage

Returns HttpRequestMessage.

RouteName

Gets the name of the route to use for generating the URL.

public string RouteName { get; }

Property Value

string

Returns string.

RouteValues

Gets the route data to use for generating the URL.

public IDictionary<string, object> RouteValues { get; }

Property Value

IDictionary<string, object>

Returns IDictionary<TKey, TValue>.

UrlFactory

Gets the factory to use to generate the route URL.

public UrlHelper UrlFactory { get; }

Property Value

UrlHelper

Returns UrlHelper.

Methods

ExecuteAsync(CancellationToken)

public virtual Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

Returns Task<TResult>.