Macros
Macros

Reputation: 7119

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?

Upvotes: 1

Views: 158

Answers (2)

SebRojas
SebRojas

Reputation: 208

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.

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

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.

Upvotes: 2

Related Questions