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 ";
}
}
{
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