ASP.NET MVC with web forms in one web application?

Has anyone successfully deployed ASP.NET MVC along with web forms in one application in a production environment? Have there been any conflicts or problems that you encountered while doing this?

Is it really as simple as shown here in practice? How about launching MVC using the Razor view engine next to web forms?

+7
source share
5 answers

Mvc is built on top of asp.net as webforms, so yes, it's easy. This has been done several times for conversion purposes.

Maybe this url might help you:

http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx

and

http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx

+10
source

One of them does not put your WebForms in the Views folder. I did not understand how to make MVC leave these paths alone. In this case, none of the ignore routing commands work, and WebForms throw 404s.

In addition, WebForms works great with MVC with MVC2 .

+3
source

Has anyone successfully deployed ASP.NET MVC along with Web Forms to the same application in a production environment?

I have never mixed ASP.NET MVC and classic WebForms in one application. I run them in separate applications and communicate between them with standard HTTP methods (query string parameters, messages in the form, cookies, ...).

Is it really as simple as shown here in practice?

Yes, it is just as easy.

+2
source

Reject the scomm hanselmans AddMvc3ToWebForms nuget package. I use it and it works very well. I use it to gradually convert my web forms application to mvc

+2
source

I have spent a lot of time over the past few months on this. Here are my observations.

Good / Easy - Getting Webforms to be Webforms in MVC Controllers - It was great to just get on a new MVC3 project and drop Webforms pages. - I managed to move the <pages><controls></controls></pages> section to the <pages><controls></controls></pages> directory in the new web.config there

Dirty / difficult

  • Regarding GUID

    • Please note that the GUID must be added at the beginning of the line for some reason ... every time I tried it failed. Until I came across a message that insisted that it would be up to others.
    • Also I don’t know what the difference is, but another GUID works for me ... {E53F8FEA-EAE0-44A6-8774-FFD645390401}
  • getting landing page Webforms caused ALL kinds of crashes.

  • Getting jQuery intellisense for playback using T4MVC

this is what i did to solve this problem

 @if (System.Diagnostics.Debugger.IsAttached) { <script src="../../Scripts/Mvc3/jquery-1.7-vsdoc.js" type="text/javascript"></script> @* intellisense! *@ @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_1_7_js) @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_unobtrusive_ajax_js) } else { @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_1_7_min_js) @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_unobtrusive_ajax_min_js) } 

Recommendations:

  • Use T4MVC in all cases, even if you are pure web forms. The output of magic strings for static content ( .js , .css , images specifying patterns) is outstanding.
+2
source

All Articles