Asp.net MVC and regular html pages

I am going to create a fairly simple website that will contain several static pages (they will never change) and one dynamic change (let it be called news). I wondered if MVC could be used here without creating controllers and views for these β€œstatic” pages. Isn't that too much overhead?

Is there a way to get MVC to simply redirect incoming requests to valid documents without actually creating a controller?

+7
asp.net-mvc
source share
2 answers

Just put your static content in a separate directory and link it there. ASP.NET will simply serve static content as usual when the path to the actual file is. I created a static folder in the Content folder, but you can put it anywhere. Files can even live in the root of the site.

+-Content +-images +-static +-about.html +-info.html +-styles +-site.css +-themes ... 
+11
source share

For "static" aspx files, you need to include a route (or use catch all by default) something like this:

 public SomeAction ActionResult(string pageName) { return View(pageName); } 

And this should allow someone to make presentations in the appropriate folder, and then add them and execute them on the fly.

0
source share

All Articles