public class MyActionNameSelectorAttribute : ActionNameSelectorAttribute
    {
        public override bool IsValidName(ControllerContext controllerContext, string actionName, MethodInfo methodInfo)
        {
            if (actionName != "Index")
            {
            controllerContext.HttpContext.Response.Redirect("Index");
                return false;
            }
            return true;
        }
    }
    public class HomeController : Controller
    {
        //
        
// GET: /Home/

       [MyActionNameSelectorAttribute]
        public string Index(string data )
       {
           return "Binggo";
       }
     
    }

as you can see  when i press enter then the page is jump to the index page .aka index action 

 

posted on 2013-06-20 00:11  Nikain  阅读(432)  评论(0编辑  收藏  举报