简体   繁体   中英

How can I execute PHP code from ASP.NET MVC

I want to do something like the following:

public class HomeController : Controller
{
    // Redirect to the phpinfo.php file
    public ActionResult PhpInfo()
    {
        return RedirectToRoutePermanent("~/Views/Home/PhpInfo.php");
    }
}

This errors out saying that the route cannot be found.

Any ideas?

Thanks, Zain

Answer from scartag in the comments. Stating it below for posterity:

It doesn't seem to be possible using the C# part of ASP.NET, but you can post links by using <a href="/PhpInfo.php">PHP Info</a> syntax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM