Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mix WebForms and MVC in ASP.NET

Tags:

I have an existing ASP.NET WebForms 3.0 application that works just fine. I upgraded it to ASP.NET 4 and it still works great, but now I want to add some ASP.NET MVC pages to it. I don't want to rewrite the application.

Any suggestions? Can I mix them? How to work it? Any tutorials for me?

like image 648
user1478501 Avatar asked Jul 05 '12 03:07

user1478501


People also ask

Can you mix Web Forms and MVC?

Luckily, the answer is yes. Combining ASP.NET Webforms and ASP.NET MVC in one application is possible—in fact, it is quite easy. The reason for this is that the ASP.NET MVC framework has been built on top of ASP.NET.

Can we add ASPX page in MVC?

If you add a plain ASPX page to an ASP.NET MVC project, well, it just works like a charm without any changes to the configuration. If you invoke the ASPX page, the ASPX page is processed with viewstate and postbacks.

Is ASP.NET Web Forms dead?

Does this mean ASP.NET Web Forms is dead and should no longer be used? Of course not! As long as the . NET Framework ships as part of Windows, ASP.NET Web Forms will be a supported framework.

When should I use ASP.NET MVC vs Web Forms?

Asp.Net MVC has Partial Views for code re-usability. Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access. Asp.Net MVC is lightweight, provide full control over markup and support many features that allow fast & agile development.


1 Answers

Take a look at Scott Hanselman's blog article on this very topic:

Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications

like image 173
IrishChieftain Avatar answered Nov 01 '22 05:11

IrishChieftain