is it possible to add a single Controller and possibly a view or two, in a class library ... which could then be redistributed (ie. via NuGet) and reused in various applications?
I'm thinking of providing a default view (or two) but allowing the consumer to override this view via a public property.
Possible?
ASP.NET MVC is no longer in active development.
In ASP.Net you need to register one tagprefix and then use the user control by tagprefix registered but in ASP.Net MVC using simple Thml. RenderPartial we can use the user control.
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller.
ControllerBase : A base class for an MVC controller without view support.
There is nothing built-in ASP.NET MVC 3 allowing you to embed views into class libraries (controllers, yes, but not views). It is necessary to write a custom VirtualPathProvider. Here's a blog post which might put you on the right track. And you could also take a look at MVCContrib portable areas which allows you to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With