BT

Shared View Management for ASP.NET MVC

by Jonathan Allen on Mar 08, 2012 |

Normally views in ASP.NET are organized by the controller that ‘owns’ them. If a view isn’t found in this location, then by convention the MVC runtime looks in the “Views\Shared”. This simple organization scheme works well for small projects, but can become quite unwieldy as the size of the web site grows and the shared folder becomes an ever larger dumping ground.

Michael Kennedy’s Enhanced View Locations project allows developers to tame the shared view folder. By referencing a small library (only 8KB) in their Application_Start event, developers can register as many additional folders as they see fit. It isn’t a perfect solution, sub-folders are not automatically included, but it is still preferable to seeing dozens or even hundreds of shared views in one massive folder.

 

Enhanced View Locations is offered via the MIT license. It is available on NuGet and instructions for its use can be found on Michael Kennedy’s blog.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT