I have a piece of code like
foreach(var controller in controllers)
{
// ...
var actions = controller.GetMethods()
.Where(method => method.ReturnType == typeof(IHttpActionResult));
foreach(var action in actions)
{
// ...
var httpMethodAttribute = action.GetCustomAttributes(typeof(System.Web.Mvc.ActionMethodSelectorAttribute), true).FirstOrDefault() as System.Web.Mvc.ActionMethodSelectorAttribute;
// ...
}
}
but for some reason httpMethodAttribute
is always null
even when I can confirm that the action
has a CustomAttribute
that is
a System.Web.Mvc.ActionMethodSelectorAttribute
. Any idea what I'm doing wrong?