
[英]Understanding [HttpPost], [HttpGet] and Complex Actionmethod parameters in MVC
[英]Define an ActionMethod has [HttpPost] in mvc4 HandleErrorAttribute extension class
我想知道一个动作方法是否具有[HttpPost]。 我的代码如下。 但是它总是返回null。
string actionName = filterContext.RouteData.Values["action"].ToString();
Type controller = filterContext.Controller.GetType();
MethodInfo method = controller.GetMethod(actionName); //OK Code
var attribute = method.GetCustomAttribute(typeof(HttpPostAttribute), true); //returns null
有什么建议吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.