一个ASP.NET MVC项目中的Web表单? [英] Web forms within an ASP.NET MVC project?

查看:123
本文介绍了一个ASP.NET MVC项目中的Web表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个管理区添加到ASP.NET MVC项目,我需要它使用ASP.NET Web窗体,而不是MVC。

I need to add an "Admin" Area to an ASP.NET MVC project, and I need it to use ASP.NET Web Forms, not MVC.

能否ASP.NET Web窗体在ASP.NET MVC应用程序中使用?

Can ASP.NET Web Forms be used in an ASP.NET MVC application?

推荐答案

我也有类似的在MVC项目的东西,因为我们不得不使用页面上的一些第三方控件。所以,我们所做的是这样的:

I have something similar in an MVC project because we had to use some 3rd party controls on a page. So what we did was this:

在在的global.asax.cs中的RegisterRoutes添加:

In the RegisterRoutes in global.asax.cs add:

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

和添加你的WebForms的东西到的WebForms目录(当然你可以改变任何你需要的,只要它不与任何你的MVC路线的冲突。

And add your webforms stuff to the WebForms directory (obviously you can change that to whatever you need, so long as it doesn't clash with any of your MVC routes.

我认为这是它。除了是一个非常可怕的杂牌组装电脑。

I think that was about it. Other than being a really horrible kludge.

这篇关于一个ASP.NET MVC项目中的Web表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆