CreatedAtRouteResult Class

An Microsoft.AspNetCore.Mvc.ActionResult that returns a Created (201) response with a Location header.

Namespace
Microsoft.AspNetCore.Mvc
Assemblies
  • Microsoft.AspNetCore.Mvc.Core

Syntax

public class CreatedAtRouteResult : ObjectResult, IActionResult
class Microsoft.AspNetCore.Mvc.CreatedAtRouteResult

Constructors

CreatedAtRouteResult(System.Object, System.Object)

Initializes a new instance of the Microsoft.AspNetCore.Mvc.CreatedAtRouteResult class with the values provided.

Arguments:
  • routeValues (System.Object) – The route data to use for generating the URL.
  • value (System.Object) – The value to format in the entity body.
public CreatedAtRouteResult(object routeValues, object value)
CreatedAtRouteResult(System.String, System.Object, System.Object)

Initializes a new instance of the Microsoft.AspNetCore.Mvc.CreatedAtRouteResult class with the values provided.

Arguments:
  • routeName (System.String) – The name of the route to use for generating the URL.
  • routeValues (System.Object) – The route data to use for generating the URL.
  • value (System.Object) – The value to format in the entity body.
public CreatedAtRouteResult(string routeName, object routeValues, object value)

Methods

OnFormatting(Microsoft.AspNetCore.Mvc.ActionContext)
public override void OnFormatting(ActionContext context)

Properties

Microsoft.AspNetCore.Mvc.CreatedAtRouteResult.RouteName

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

Return type:System.String
public string RouteName { get; set; }
Microsoft.AspNetCore.Mvc.CreatedAtRouteResult.RouteValues

Gets or sets the route data to use for generating the URL.

Return type:Microsoft.AspNetCore.Routing.RouteValueDictionary
public RouteValueDictionary RouteValues { get; set; }
Microsoft.AspNetCore.Mvc.CreatedAtRouteResult.UrlHelper

Gets or sets the Microsoft.AspNetCore.Mvc.IUrlHelper used to generate URLs.

Return type:Microsoft.AspNetCore.Mvc.IUrlHelper
public IUrlHelper UrlHelper { get; set; }