MVC adding static html pages

ThomasQ
ThomasQ used Ask the Experts™
on
Hi,

How do we add static html pages into a MVC project and display them? I initially thought it was easy same as normal ASP.NET, not true. Some forum talked about hijacking the view engine and handle it like handling a jpg, pdf or txt, some told me to write a view for each static html and include the html in it. Doesn't it defeat the purpose of STATIC Html? I just want a quick & dirty <b>Hello There!</b> static page. 101 basic of the basic any web technology should perform. Come on, I mean MVC is the latest technology...Is there a easy fast way I am missing out? Please point me to the correct way.

Thanks,
Tom
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Craig WagnerSoftware Architect
Commented:
I create a Content folder at the root. I then create subfolders that correspond to the View folders to which the static page logically belongs (and where it would live if it were an MVC view). I then serve up the HTML pages from that folder. The folder names are not prescribed, it's just the way I handle it. You might decide to create a folder called StaticHtmlPages. Bottom line though is that you can't put them in the View subfolders because MVC won't serve up anything from those folders directly.
static pages can be placed in content folder only, you can add more static page folders by updating the route.

see ignoreroute for more details:-

routes.IgnoreRoute("UserPages/page.htm");

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial