RESTful "different" pages in an ASP.NET MVC site?

Imagine we were doing this StackOverflow site in ASP.NET MVC (it's funny because it's ...). We need to develop views:

  • About this site
  • Faq
  • privacy policy
  • 404 page
  • Error page
  • etc...

Now, because we want to keep this RESTful, because we are trying to develop a RESTafarian Geek-fro, we are throwing them in one controller .. called .. (eeks ... er ..) MiscellaneousController or FrameworkController or Controller .. each with their own methods of action ...

or

We have one controller for each, and each of these controllers has its own index action.

Now, technically, I KNOW that you can do it anyway. So it's not a question of how to technically do it. It's more about good practice if you stick to a nice and hippy RESTful way.

Thoughts?

+1


source to share


1 answer


"REST" will come from your routing, not your controller, if I understand you correctly.

If you mean how you should do this in terms of MVC programming techniques, I would be tempted to create a MiscController with a "general" or "index" method that takes an id / topic parameter and then displays the page.

This is because the action of all these pages is the same - they display some common content.



This way they can all use the same view and maybe just read the display text from the database.

If you have a different view for each section, I would use a different action for each section.

I tend to use a new controller for any site segment or grouped functionality and action for every possible exeuction kind or action.

+1


source







All Articles