开发者

How to include a large number of static pages in a MVC application?

开发者 https://www.devze.com 2023-03-18 09:18 出处:网络
The client of a ASP.NET MVC3 project has a large number of static pages - think \"pages\" for WordPress blog, and they are linked to each other. I need to render the content of the page with a dynamic

The client of a ASP.NET MVC3 project has a large number of static pages - think "pages" for WordPress blog, and they are linked to each other. I need to render the content of the page with a dynamic header and sidebar, so some of the excellent answwrs, such as this, does not apply in this case.

Right now, I have created a layout which re-use the common elements of each page and which will dyn开发者_如何学编程amically render menu depending on user's roles and permissions. I am thinking to

  1. create an action for each static page, so the dynamic content and static content would be merged together. Each static page would be a partial view in the form of a cshtml OR

  2. Make use of RenderPage, and include the url of the next page to include as a query (bad idea?). This way only one action is needed to render all the static pages which would be just cshtml.

I am trying to stay away from implementing any CMS-like capabilities as the static content is unlikely to change and the client will have their own programmers to update the page after launch.


You may want to consider creating a T4 template to automate the controller/action generation based on the files?

0

精彩评论

暂无评论...
验证码 换一张
取 消