I have a URL like below and I need to remove the controller name (myController). I\'ve use several fixes but none fixed the issue. Please help me guys..
http://fold
You could try inverting the routes definition by placing the more specialized route first. Also you probably didn't want to hardcode the action name as action but rather use the {action} placeholder:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: "Special",
url: "{action}",
defaults: new { controller = "Home", action = "LandingIndex" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Follow the below links :
Link 1
Link 2
Link 3