user1929393
user1929393

Reputation: 4267

MVC project with normal web html site together?

Is it possible to create a normal website (html + javascript) as a separate project in visual studio, but also include an MVC project together?

I would like to have my facing website in basic html for faster loading, but have other portions of the site in MVC that require serverside? Is this possible?

I would like this to be hosted on one hosting domain account.

Upvotes: 1

Views: 126

Answers (1)

Erik Philips
Erik Philips

Reputation: 54618

You don't need two projects for this. By default if there is a page that is .html it will be served to the end user without loading up the ASP.Net runtime engine (for Webforms and MVC projects).

Your structure might look like:

/Home.html
/Controllers/AdminController.cs
/Models/AdminModels.cs
/Views/Admin/Index.cshtml

Where home.html is just a basic html page with no controller or any thing, and Admin/Index runs the MVC framework.

Note:

I wouldn't recommend this because the maintainability is low, as things that are typically automated by the view engine (like Anchor tags) can be checked at runtime, but changing Actions names on controllers will break your html, and you won't know about it because they aren't tightly coupled.

Upvotes: 2

Related Questions