9

When I loaded up my new website I have some of it using MVC and the other half using static pages.

The first page should be index.html

However when I go to http://domain, it goes directly in to the MVC controller.

It does not go to index.html, even though I have IIS pointing to this page, it might be due to the fact that I am using wild cards from within IIS, as detailed in my blog http://www.bryanavery.co.uk/post/2009/07/02/Deploying-MVC-on-IIS-6.aspx

But I need the first page to go to index.html when I select http://domain

Any ideas?

Coppermill
  • 6,676
  • 14
  • 67
  • 92
  • See [this solution](http://stackoverflow.com/a/6560266/56286 "this solution") provided for a similar question. – Fabrice Jul 10 '12 at 16:04

3 Answers3

11

You could direct the path to a controller action and return the file like this:

public ActionResult Index()
{
    return File("index.html", "text/html");
}
Paul
  • 6,188
  • 1
  • 41
  • 63
1

Tell the routing engine to ignore index.html:

routes.IgnoreRoute("index.html");
PatrickSteele
  • 14,489
  • 2
  • 51
  • 54
1
    public ActionResult Index()
    {
        return new RedirectResult("index.html",true);
    }

This work for me.

Zax
  • 306
  • 2
  • 8