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?

1

3 Answers 3

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");
}
3
  • This causes IE8 to go in to download
    – Coppermill
    Nov 12, 2009 at 10:59
  • Nope, still getting file download :-(
    – Coppermill
    Nov 12, 2009 at 11:43
  • public ActionResult Index() { return File("index.html", "test/html"); } working :-)
    – Coppermill
    Nov 12, 2009 at 11:46
1

Tell the routing engine to ignore index.html:

routes.IgnoreRoute("index.html");
1
    public ActionResult Index()
    {
        return new RedirectResult("index.html",true);
    }

This work for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.