I am using IIS 6. I think my problem is that I don't know how to route to a non controller using the routes.MapRoute.
I have a url such as example.com and I want it to serve the index.htm page and not use the MVC. how do I set that up? In IIS, I have index.htm as my start document and my global.asax has the standard "default" routing, where it calls the Home/Index.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
I added this:
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Context.Request.FilePath == "/") Context.RewritePath("index.htm");
}
it works. But is this the best solution?