At the place I work at, we have a custom security/authentication mechanism for internal web applications using WebForms. Now we are developing in ASP.NET MVC 3 and want to extend the Controller class to support this just like we did to WebForm’s Page class. We will then pack this into a custom – shared DLL.
I want to know how safe this is in terms of compatibility with future versions of MVC.
If ASP.NET MVC 4.0 comes out next year, our custom controller classes (referencing ASP.NET MVC 3.0 Controller class) will still work in a MVC 4.0 app?
Is there any way to somehow extend a Controller without depending on an specific MVC version?
Not a duplicate of this: Extending Asp.NET MVC3 Controller Class
The problem is to inherit from the “Controller” class you need to first add a reference to Sytem.Web.Mvc which is version specific.
Each version of ASP.NET MVC will have it’s own DLL. You won’t be able to use your customer DLL designed for ASP.NET MVC3 in your MVC 4 project.
Now, you could create a class that inheirts from Controller and include it IN your ASP.NET MVC project then as your project version changes so will the reference to “Controller” but thats only because your project has the reference to the version.