我必须得使用HttpRuntime.AppDomainAppPath
(这样C:/personal/Website/page.aspx
)如何检查父文件夹
Web服务始终位于父文件夹(如本C:/personal/Service/service.asmx
)的page.aspx父我的网站路径。我使用servicePath
这个字符串servicePath="C:/personal/Service/service.asmx"
这个变量,使用ABC.dll中的web.dll服务路径。
如何根据网站路径检查服务路径?
If (GetWebPath()== GetServicePath())
{
// ... do something
}
private string GetWebPath()
{
string path = HttpRuntime.AppDomainAppPath;
string[] array = path.Split('\\');
string removeString = "";
for(int i = array.Length; --i >= 0;)
{
removeString = array[array.Length - 2];
break;
}
path = path.Replace(@"\" + removeString + @"\", "");
return path;
}
private string GetServicePath()
{
string path = @"C:\MNJ\OLK\ABC.asmx"
string[] array = path.Split('\\');
string removeString = "";
for(int i = array.Length; --i >= 0;)
{
removeString = @"\" + array[array.Length - 2] + @"\" + array[array.Length - 1];
path = path.Replace(removeString, "");
break;
}
return path;
}
伊诺什么ü不明白,请告诉我,我会阐述它... – John 2013-03-13 09:32:31
伊诺看到下面的评论.... – John 2013-03-13 10:23:24
服务路径d: \ data \ webspace \ MPS.3.0 \ SPM \ Server.asmx – John 2013-03-13 10:24:02