Decrease Font Size
Increase Font Size
   BLOG

ASP-NET-4-URL-Routing-Default-Page

The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character.Parameter name: routeUrl.|

URL Routing with ASP.NET 4 Web Forms|

ASP.NET 4.0 URL Routing Default.aspx page

 

Problem

I was implementing ASP.NET routing features for one of the web application. The code was working correctly in the development environment. Then I deployed it to staging server, navigate to http://mydomain.com/ and received the error
"404 File Not Found".
I tried to include routes.MapPageRoute("Default", "/", "~/Default.aspx"); in the global.asax file but I received another error
"The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character.Parameter name: routeUrl".
After several trials and errors, I found out that we should leave the "URL with parameters" empty. See below.

routes.MapPageRoute("Default", "", "~/Default.aspx");

I hope you all will find this information useful.