有没有办法从ASP.NET的URL获取物理文件路径? Scenerio:我有一个在两台服务器上的应用程序,但现在会有很多应用程序,并且每台服务器都将它放在不同的物理文件路径中。现在我这样做:ASP.NET从URL获取物理文件路径
//for server 1
if (Request.Url.GetLeftPart(UriPartial.Path).Contains(".com"))
{ Application["StoreFilesPath"] = "E:\\Data\\rootsite\\f1\\appsite\\Upload\\"; }
//for server 2
if (Request.Url.GetLeftPart(UriPartial.Path).Contains(".net"))
{ Application["StoreFilesPath"] = "E:\\Web\\rootsite2\\f34\\abc\\ghi\\appsite\\Upload\\"; }
但我需要做的是这样的:
//for all servers
Application["StoreFilesPath"] = getPhysicalFilePath() +"\\Upload\\";
我该怎么办呢?