开发者

How can I have a PHP page inside of an ASP.NET MVC project?

We're migrating our existing PHP site to ASP.NET MVC. Rather than rebuild everything at once we'd like to be able to include some of our existing PHP applic开发者_高级运维ations inside of our new MVC project.

I've used the Windows Platform Installer to setup PHP support for IIS. I've tested this by putting a PHP file inside of the inetpub/wwwroot folder and it works well.

However, when I try add a PHP file to my MVC project and then access it in a browser it's downloading the file rather than running it.

Ignoring PHP files in the routing engine didn't solve this problem.

Anyone know how to make this work?

Thanks!


Sounds like the MVC engine is trying to process your php file. I think maybe setting up *.php as an ignorable route would do the trick?

In global.asax.cs:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.php/{*pathInfo}");

    // rest of route configuration
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜