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 

and  

posted on 2013-06-19 23:40  Nikain  阅读(424)  评论(0编辑  收藏  举报