public class MyActionMethodSelectorAttribute:ActionMethodSelectorAttribute
    {
        public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
        {
            if ((controllerContext.HttpContext.Request["data"]) == "no")
                return false;
                return true;
        }
    }
    public class HomeController : Controller
    {
        //
        
// GET: /Home/

       [MyActionMethodSelectorAttribute()]
        public string Index(string data)
       {
           return "I returned an string is "+data+"<br/>";
       }
     
    }

so as you can see ASP.NET MVC 4 - ActionMethodSelectorAttribute

and ASP.NET MVC 4 - ActionMethodSelectorAttribute 

相关文章:

  • 2022-12-23
  • 2022-02-18
  • 2021-12-28
  • 2022-01-10
  • 2021-10-31
  • 2021-08-23
  • 2021-11-17
  • 2021-07-10
猜你喜欢
  • 2021-11-19
  • 2021-12-23
  • 2021-06-28
  • 2021-10-16
  • 2022-01-12
  • 2021-11-14
相关资源
相似解决方案