Search code examples
asp.netasp.net-routing

ASP.NET url routing, default path


I expected this would also map the default homepage as in http://localhost/ but it is not hit.

RouteTable.Routes.Add(new Route("{Keyword}", new HomeHandler()));

Question is of course why not? I would like to map the root to some other page.


Solution

  • I haven't tried this yet but try removing the default document from IIS's configuration. For IIS 7 this setting is in web.config:

    <configuration>
     <system.webServer>
      <defaultDocument>
       <files>
        <clear />
       </files>
      </defaultDocument>
     </system.webServer>
    </configuration>