Getting MVC default route to go to ~/default.asp

Posted by Dave Hanna on Stack Overflow See other posts from Stack Overflow or by Dave Hanna
Published on 2010-06-10T13:38:55Z Indexed on 2010/06/10 13:42 UTC
Read the original article Hit count: 302

Filed under:

I am adding some MVC features to an existing site (FWIW, most of which is in classic ASP). As a result, I need to keep the default routing going to ~/default.asp (at a minimum - preferably the default document specified in IIS).

Is there a way to write the route in RegisterRoutes so that a request for the root of the site (e.g., http://localhost, http://localhost/, or http://localhost/default.asp) will directly get the default page, and not attempt to find a controller/action? Or do I need to write my own HttpModule that will filter it and keep it from getting to the MvcHandler (as in this blog)?

BTW, I have googled this, but most of the hits are for MVC version 1 or older, and default routing appears to have changed in version 2 (i.e, there is no more default.aspx that redirects to ~/Home), so they are not directly applicable. Even so, the ones that were there didn't address this problem.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-routing