ASP.NET MVC projects follow naming and folder conventions for Models, Views and Controllers. For other code (ex: Action Filters, Delegating Handlers, etc), is there a best practice as to where to locate these in the project's folder structure?
2 Answers
A good way to find out is by checking out what the actuall best practices are is to see Open Source projects. IIRC the NuGet Gallery was written by the Asp.Net MVC guys, so it would serve as a good example for what they view as Best Practices while still being an actual product:
https://github.com/NuGet/NuGetGallery
It looks like they added their FilterAttributes, HtmlHelpers, etc. to the root of the project : https://github.com/NuGet/NuGetGallery/blob/master/Website/RequireRemoteHttpsAttribute.cs
Also, Phil Haack and David Ebbo worked on the Asp.Net MVC team, and you can check out their GitHub repos for what they like to do.

- 3,476
- 20
- 19
-
Is it a good idea to keep the controllers in a separate project and views in a separate project? – user20358 May 31 '12 at 10:39
There is no standard way as such. Different practitioners have put up various methods but all have some pros and cons. However, based on applicable design constraints, here are some pointers :
Reusability
If you want your Action Filters, Delegating Handlers etc to be reusable, then placing them in a dedicated folder in asp.net mvc webroot will do the job. That way all such filters will have global scope and can be used as needed.
Pluggability
If want to create a pluggable module out of the filters etc. It might be worth placing them in a separate DLL altogether. The library can be thought of as a black box which takes all contextual information as function inputs and can be reused as required. I liked the pluggable architecture of Orchard CMS http://www.orchardproject.net/
I asked a similar question sometime back on how to organize models in asp.net mvc project. Unfortunately didn't get much response. Models in asp.net mvc 3 areas

- 1
- 1

- 1,942
- 16
- 15