从ASP.NET WebForms迁移到ASP.NET MVC

时间:2022-03-15 03:22:18

I'm developing a web application for a company which I work for. My team started working on the app few months ago and the decision was to build it with ASP.NET WebForms. Now we've quite a lot of the code developed and we're wondering if ASP.NET WebForms was a good choice. Maybe we should migrate. Ok, but what's the first step? We don't want to rewrite everything from scratch. We'd like to add a new stuff in MVC and rewrite the old part in the future (gradually). Is it possible to add somehow ASP.NET MVC application to current WebForms one? Can they live together?

我正在为我工​​作的公司开发一个Web应用程序。几个月前,我的团队开始使用该应用程序,并决定使用ASP.NET WebForms构建它。现在我们已经开发了很多代码,我们想知道ASP.NET WebForms是不是一个好选择。也许我们应该迁移。好的,但第一步是什么?我们不想从头开始重写所有内容。我们想在MVC中添加一些新东西,并在未来(逐渐)重写旧部分。是否有可能以某种方式将ASP.NET MVC应用程序添加到当前的WebForms中?他们可以住在一起吗?

2 个解决方案

#1


8  

Asp.net webforms and MVC can live happily together. You will add some includes and directores and add a route which will cause your webforms pages to be ignored. All explained here:

Asp.net webforms和MVC可以幸福地生活在一起。您将添加一些包含和直接导航,并添加一条路线,这将导致您的网页表单被忽略。所有解释如下:

http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc

http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc

#2


6  

Mixing MVC with webforms is not that all hard. Basically, you want to ignore any exisiting .aspx routes in your global.asax, and then add routes for new pages that you want to build using MVC.

将MVC与webforms混合并不是那么难。基本上,您希望忽略global.asax中任何现有的.aspx路由,然后为要使用MVC构建的新页面添加路由。

See this article for more details.

有关详细信息,请参阅此文章。

#1


8  

Asp.net webforms and MVC can live happily together. You will add some includes and directores and add a route which will cause your webforms pages to be ignored. All explained here:

Asp.net webforms和MVC可以幸福地生活在一起。您将添加一些包含和直接导航,并添加一条路线,这将导致您的网页表单被忽略。所有解释如下:

http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc

http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc

#2


6  

Mixing MVC with webforms is not that all hard. Basically, you want to ignore any exisiting .aspx routes in your global.asax, and then add routes for new pages that you want to build using MVC.

将MVC与webforms混合并不是那么难。基本上,您希望忽略global.asax中任何现有的.aspx路由,然后为要使用MVC构建的新页面添加路由。

See this article for more details.

有关详细信息,请参阅此文章。