开发者

ASP.net MVC Controller Architecture

This might seem a slightly subjective question however I am looking for what is deemed best practice in the MVC World. I am fine with the idea of separate controllers for separate logical areas and in the whole this makes sense however how should standard pages be handled? For example, I have开发者_开发知识库 an about us page, a careers page, etc. Some of these pages will have their own functionality and where that is the case they will have their own controller and views. The rest of these pages will just be text - do these then warrant their own controller? Or should they be routed to a SimplePageController which returns a view based on the URL?


The rest of these pages will just be text - do these then warrant their own controller?

Without really knowing your exact scenario it is difficult to answer but static HTML files for static pages works just fine.


I think you can have a controller for static pages. The Controller will manage the shares, which in the case of these pages would only GET actions. If you see, when you create an MVC application in Visual 2010, that's created with a HomeController, which has the action for static pages such as home and about.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜