
How do I set a “Default Action” for my Controller that will be called when no other action matches
By: a guest on
Feb 28th, 2012 | syntax:
None | size: 0.41 KB | hits: 17 | expires: Never
routes.MapRoute("Default", "{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" });
protected override void HandleUnknownAction(string actionName) {
//your code here.
}
routes.MapRoute("default-action", "{controller}/{actionName}/{id}", new {action="DefaultAction"});
public ActionResult DefaultAction(string actionName, string id) {
//handle default action
}