Looking at the code for ActionMethodSelector, it appears that all action method attributes must return true for IsValidForRequest before that action will be added to the set of possible matching methods. Since it's not possible for HttpPost and HttpDelete to return IsValidForRequest for the same request, I would expect that using both will prevent that action from ever matching any request.
Here's a telling comment from the code:
private static List RunSelectionFilters(...) {
// remove all methods which are opting out of this request
// to opt out, at least one attribute defined on the method must return false
(emphasis mine)
Note that you can still use AcceptVerbs and explicitly OR the verbs if you need to match either.
EDIT -- here's an HttpPostOrDelete attribute for you.
[AttributeUsage( AttributeTargets.Method, AllowMultiple = false, Inherited = false )]
public class HttpPostOrDeleteAttribute : ActionMethodSelectorAttribute
{
private static readonly AcceptVerbsAttribute _innerPostAttribute = new AcceptVerbsAttribute( HttpVerbs.Post );
private static readonly AcceptVerbsAttribute _innerDeleteAttribute = new AcceptVerbsAttribute( HttpVerbs.Delete );
public override bool IsValidForRequest( ControllerContext controllerContext, System.Reflection.MethodInfo methodInfo )
{
return _innerDeleteAttribute.IsValidForRequest( controllerContext, methodInfo )
|| _innerPostAttribute.IsValidForRequest( controllerContext, methodInfo );
}
}
AcceptVerbs
, but I think the new attributes look a lot nicer in the code, and had hoped the MVC team had thought about this when implementing them... – Sphagnum