ASP.NET MVC Routing to start at html page -


I am using IIS 6. I think my problem is that I do not know how the non-controller route routes Routes.MapRoute.

I have an example, such as example.com and I want it to serve the index.htm page and not use MVC. How do I set it? In IIS, the index is HTM as my initial document and I have standard "default" routing in Global.assx, where it calls home / index Public Status Records Register Routes New {controller = "home", action = "index", id = ""} with routes ("default", // root name "{controller} / {action} / {id}", // URL parameter / Parameter defaults); }

I added it:

  Secure void Application_BeginRequest (Object Sender, EventArgs e) {if (Context.Request.FilePath == "/") Context.RewritePath ("index.htm"); }  

It works but is this the best solution?

I have added a dummy controller to be used as the original controller when the root web site Is specified. This controller has a single index action that redirects to the index.htm site on the root.

  Public category documentation controller: controller {public performance index} {return redistribution (URL. Resource ("~ / Index.htm")); }}  

Note that I am using this documentation of a MVC-based REST web service. If you go to the root of the site, you get the service documentation instead of some default web service method.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -