如何在ASP.NET中混合WebForms和MVC

时间:2022-06-13 03:18:32

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.

我有一个现有的ASP.NET WebForms 3.0应用程序,可以很好地工作。我将它升级到ASP.NET 4,它仍然很好用,但现在我想添加一些ASP.NET MVC页面。我不想重写应用程序。

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

有什么建议么?我可以混合它们吗?怎么工作呢?对我来说有什么教程吗?

2 个解决方案

#1


8  

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

看看Scott Hanselman关于这个主题的博客文章:

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

将ASP.NET MVC 3集成到现有升级的ASP.NET 4 Web窗体应用程序中

#2


4  

You have to mention this line of code in the Global.asax file in the MVC application.

您必须在MVC应用程序的Global.asax文件中提及此行代码。

routes.IgnoreRoute("{WebPage}.aspx/{*pathInfo}");

This disables the MVC routing for the files of extension .aspx

这将禁用扩展名.aspx文件的MVC路由

#1


8  

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

看看Scott Hanselman关于这个主题的博客文章:

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

将ASP.NET MVC 3集成到现有升级的ASP.NET 4 Web窗体应用程序中

#2


4  

You have to mention this line of code in the Global.asax file in the MVC application.

您必须在MVC应用程序的Global.asax文件中提及此行代码。

routes.IgnoreRoute("{WebPage}.aspx/{*pathInfo}");

This disables the MVC routing for the files of extension .aspx

这将禁用扩展名.aspx文件的MVC路由