The problem of mixing web forms in an ASP.NET MVC application

I tried with the idea to take an existing ASP.NET Webforms application and convert it to a hybrid so that in the future we can make ASP.NET MVC.

To do this, I created an ASP.NET MVC application and started copying some of the folders from ASP.NET web form projects containing web forms. I had a problem with creating as a result of a project receiving hundreds of compilation errors in this form:

Error 1951 'Documents_Admin_DocPushByTag' does not contain a definition for 'CtlCategoryList' and no extension method 'CtlCategoryList' accepting a first argument of type 'Documents_Admin_DocPushByTag' could be found (are you missing a using directive or an assembly reference?) 

Each of these error messages relates to server controls in my markup. As if the markup is not being processed? When I edit one of the code files and type this. To find out what intellisense recognizes, these controls are not displayed. Event handlers (but this should be because they are defined in the code behind the file). As far as I can tell, the CodeFile and Inherit attributes are correct (and unchanged from the ASP.NET project where they came from). I am puzzled by what causes this problem. Any ideas? TIA.

+4
source share
2 answers

check how scott hanselman does this:
http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx

basicallly, you should use ignoreroute to exclude all your web forms from routing in the mvc handler

+4
source

I think it will be much easier for you to convert the System.Web.Mvc assemblies into your current project and update the web.config and global.asax files.

You need to make sure that your current application is a web application (not a website) project. If it does not convert it and does not force it to compile first.

+3
source

All Articles