HttpMethodAttribute Class

Summary

Identifies an action that only supports a given set of HTTP methods.

Syntax

public abstract class HttpMethodAttribute : Attribute, _Attribute, IActionHttpMethodProvider, IRouteTemplateProvider

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.HttpMethodAttribute

Constructors

HttpMethodAttribute(System.Collections.Generic.IEnumerable<System.String>)

Creates a new [Microsoft.AspNet.Mvc.HttpMethodAttribute](Microsoft.AspNet.Mvc.HttpMethodAttribute.yml) with the given set of HTTP methods.

<param name=”httpMethods”>The set of supported HTTP methods.</param>

Arguments:
  • httpMethods (System.Collections.Generic.IEnumerable{System.String}) –
public HttpMethodAttribute(IEnumerable<string> httpMethods)
HttpMethodAttribute(System.Collections.Generic.IEnumerable<System.String>, System.String)

Creates a new [Microsoft.AspNet.Mvc.HttpMethodAttribute](Microsoft.AspNet.Mvc.HttpMethodAttribute.yml) with the given set of HTTP methods an the given route template.

Arguments:
  • httpMethods (System.Collections.Generic.IEnumerable{System.String}) – The set of supported methods.
  • template (System.String) – The route template. May not be null.
public HttpMethodAttribute(IEnumerable<string> httpMethods, string template)

Properties

HttpMethods()
Return type:System.Collections.Generic.IEnumerable{System.String}
public IEnumerable<string> HttpMethods { get; }
Order()
Return type:System.Nullable{System.Int32}
int ? IRouteTemplateProvider.Order { get; }
Name()
Return type:System.String
public string Name { get; set; }
Order()

Gets the route order. The order determines the order of route execution. Routes with a lower order value are tried first. When a route doesn’t specify a value, it gets the value of the [Microsoft.AspNet.Mvc.RouteAttribute.Order](Microsoft.AspNet.Mvc.RouteAttribute.yml) or a default value of 0 if the [Microsoft.AspNet.Mvc.RouteAttribute](Microsoft.AspNet.Mvc.RouteAttribute.yml) doesn’t define a value on the controller.

Return type:System.Int32
public int Order { get; set; }
Template()
Return type:System.String
public string Template { get; }