I’m tring to create a route with only the action name, look:
routes.MapRoute(
"UnderConstruction", // Route name
"UnderConstruction", // URL with parameters
new { controller = "Alert", action = "UnderConstruction"} // Parameter defaults
);
And with this i want to access the url like that: http://localhost/UnderConstruction
But when i call this url i got the error “The resource cannot be found.”. What am i missing or doing wrong?
You have to put this route before your default route otherwise it will be matched to default route first and it will try to look for a controller named UnderConstruction.