Class AcceptVerbsAttribute
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
verbsstring[]The HTTP verbs that the action method will respond to.
Exceptions
- ArgumentException
The
verbsparameter 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
verbsHttpVerbsThe 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
controllerContextControllerContextThe controller context.
methodInfoMethodInfoThe method information.
Returns
- bool
true if the method information is valid; otherwise, false.
Exceptions
- ArgumentNullException
The
controllerContextparameter is null.