Hello,
I have been testing a few options with Route Debugger but no luck. Let me describe what I am trying:
I have all routes "translated" as follows (I needed to translate from English to Portuguese and sometime simplify):
routes.MapRoute("Article.Create", "cms/artigo/criar",
new { controller = "Article", action = "Create" });
Everything is working. Since I have all routes defined I think I don't need Default one. So I have something like:
// Other translation routes
routes.MapRoute("Article.Create", "cms/artigo/criar",
new { controller = "Article", action = "Create" });
routes.MapRoute("Article.Edit", "cms/artigo/editar/{id}",
new { controller = "Article", action = "Edit", id = "" });
routes.MapRoute("Home.Index", "inicio",
new { controller = "Home", action = "Index" });
routes.MapRoute("Home.Contact", "contacto",
new { controller = "Home", action = "Contact" });
// Error Unknown
routes.MapRoute("Error.Unknown", "erro",
new { controller = "Error", action = "Unknown" });
// Start
routes.MapRoute("Start", "_Default.aspx",
new { controller = "Home", action = "Index" });
// Error NotFound
routes.MapRoute("Catch.All", "{*path}",
new { controller = "Error", action = "NotFound", path = "" });
If the root goes through the translation mapping with no match then if it is an Unknown Error displays only "http://domain.com/erro"
If not then try to match Home/Index.
Finally goes to catch all route and display only the path as follows "http://domain.com/the/invalid/path
On my Web.Config I have:
<customErrors mode="On" defaultRedirect="~/Error/Unknown">
<error statusCode="404" redirect="~/Error/NotFound" />
</customErrors>
What happens is when I start my site it always goes to NotFound error and not to start page.
What am I doing wrong?