我有一个使用Php的域名,但我添加了asp.net代码。并尝试执行它只显示asp.net代码。是否可以通过使用任何插件或一些第三方帮助在php域下添加asp.net代码。如果是的话,请提出一些想法。
答案 0 :(得分:0)
您可以使用HttpWebRequest从PHP页面获取结果,这可能对您有所帮助。举例来自:https://stackoverflow.com/a/9818700/4068558
string myRequest = "abc=1&pqr=2&lmn=3";
string myResponse="";
string myUrl = "Where you want to post data";
System.IO.StreamWriter myWriter = null;// it will open a http connection with provided url
System.Net.HttpWebRequest objRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(myUrl);//send data using objxmlhttp object
objRequest.Method = "GET";
objRequest.ContentLength = TranRequest.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";//to set content type
myWriter = new System.IO.StreamWriter(objRequest.GetRequestStream());
myWriter.Write(myRequest);//send data
myWriter.Close();//closed the myWriter object
System.Net.HttpWebResponse objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();//receive the responce from objxmlhttp object
using (System.IO.StreamReader sr = new System.IO.StreamReader(objResponse.GetResponseStream()))
{
myResponse= sr.ReadToEnd();
}
否则,问题是IIS会看到一个.php文件并用PHP编译它。反之亦然ASP。虽然在ASP.NET中运行PHP的工作是phalanger。