I've created a default WebSite under Visual Studio 2010. Added a simple routing there into Global.asax:
routes.MapPageRoute("AboutRoute", "about", "~/About.aspx");
This shows 404 when I start ASP.NET Development Server and browse to "http://localhost:6521/WebSite1/about"
But works nicely when I change about
to about.axd
(notice the .axd extension) and browse to /WebSite1/about.axd
What do I need to change in web.config to make Development Server work as IIS does (correctly handles extension-less URLs)?
I prepared a sample Web Application, which gave me About us and Default.aspx pages. In default.aspx page, I wrote the following code....
Default.aspx.cs Code
Global.asax.cs Code
Then I published the code and configured it on IIS. Now When the Request Reaches IIS, It routed the message to the aspnet_isapi.dll ISAPI extension. ISAPI extension then loaded the default.aspx page, execute it, and return its rendered HTML to IIS, and finally IIS then sends it back to the client.
Resultant URL
http://localhost/Demo/about/Evgenyt
Actual URL
http://localhost/Demo/AboutUs.aspx
Reference - Unlike
URLMapping
, URLRouting does not take place in Web.config. It can be implemented using code. You can use Application_Start Event as mentioned in your code in Glogal.asax.cs file to register all routes for your application. To register a route you can useRouteTable
class inSystem.Web.Routing
namespace.