Is it possible to host an asp.net MVC in the same

2019-07-03 16:05发布

I have a domain and a hosting account and I'd like to in a folder host an MVC app and in another host asp.net web forms app.

Is it possible?

5条回答
Melony?
2楼-- · 2019-07-03 16:54

Yes, ASP.NET web forms and ASP.NET MVC applications can reside side-by-side in the same application. I have that in my current application and it works fine. You just have to make sure that your classic ASP.NET application paths don't conflict with your ASP.NET MVC routes -- seems that the MVC routing handler wins out. I've run into that a few times.

Here's a good article that walks through hosting web forms and MVC side-by-side.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-07-03 16:57

Yes, it is possible. You can also have different web.config files for each folder. Of course, it depends on the hosting .NET version, if you can use MVC..

查看更多
Rolldiameter
4楼-- · 2019-07-03 17:04

You can also have your single hosting host multiple domains, or make a subdomain and host the legacy site there.

查看更多
forever°为你锁心
6楼-- · 2019-07-03 17:09

As others have said, this is most certainly possible. You'll likely want to modify your MVC routes to ignore requests for aspx or axd resources:

routes.IgnoreRoute("{resource}.aspx");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
查看更多
登录 后发表回答