Table of Contents

Class AcceptVerbsAttribute

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Represents an attribute that specifies which HTTP verbs an action method will respond to.

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class AcceptVerbsAttribute : ActionMethodSelectorAttribute
Inheritance
AcceptVerbsAttribute
Inherited Members

Constructors

AcceptVerbsAttribute(params string[])

Initializes a new instance of the AcceptVerbsAttribute class by using a list of HTTP verbs that the action method will respond to.

public AcceptVerbsAttribute(params string[] verbs)

Parameters

verbs string[]

The HTTP verbs that the action method will respond to.

Exceptions

ArgumentException

The verbs parameter is null or zero length.

AcceptVerbsAttribute(HttpVerbs)

Initializes a new instance of the AcceptVerbsAttribute class using the HTTP verbs that the action method will respond to.

public AcceptVerbsAttribute(HttpVerbs verbs)

Parameters

verbs HttpVerbs

The HTTP verbs that the action method will respond to.

Properties

Verbs

Gets or sets the list of HTTP verbs that the action method will respond to.

public ICollection<string> Verbs { get; }

Property Value

ICollection<string>

The list of HTTP verbs that the action method will respond to.

Methods

IsValidForRequest(ControllerContext, MethodInfo)

Determines whether the specified method information is valid for the specified controller context.

public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)

Parameters

controllerContext ControllerContext

The controller context.

methodInfo MethodInfo

The method information.

Returns

bool

true if the method information is valid; otherwise, false.

Exceptions

ArgumentNullException

The controllerContext parameter is null.