views:

244

answers:

2

I'm working on a site that is partially static content and partially MVC. The root of the site is index.html and I have all of the controllers explicitly routed and all html files ignored. However, when you hit the root of the website, it tries to route it. How can I tell the route engine to ignore the root of the site? www.mysite.com should not be routed, but instead go to index.html. Here is my routing configuration:

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("*.html|js|css|gif|jpg|jpeg|png|swf");

        routes.MapRoute(
            "vendor_signup","{vendor}/signup/{action}/",
            new { controller = "Signup", action = "Index", vendor=UrlParameter.Optional}  // Parameter defaults
        );
        routes.MapRoute(
            "signup","signup/{action}/",
            new { controller = "Signup", action = "Index", vendor=Vendors.PCICentral}  // Parameter defaults
        );
//more routes below
A: 

One of the routes was still in {} which made it try to parse the root.

+1  A: 

I believe what you mean is when someone accesses / on your website, you don't want to use MVC, but show a static page. To achieve this, you need to tell MVC to ignore that route and let webforms handle it. Webforms then should show you /index.html when it gets the request /.

Simply adding this before your routes should work:

routes.IgnoreRoute("");
René Wolferink