如题

解决方案 »

  1.   

    创建虚拟目录可以用vbs脚本。
      

  2.   

    HttpRuntime.AppDomainAppVirtualPath 当前应用程序虚拟目录另一个思路,可以参看http://community.csdn.net/Expert/topic/3388/3388655.xml?temp=.234234
    特别是思归的回复,他的想法好想是枚举所有的虚拟目录,并看相应的物理路径。可以试试
      

  3.   

    我自己写了个方法,是取得当前文件的虚拟路径,你看看
    /// <summary>
    /// 获取文件完整虚拟路径的文件名部分
    /// 例如:将“http://localhost/test.htm”分成“http://localhost/”和“test.htm”左右两部分
    /// </summary>
    /// <param name="pageUrl">文件完整虚拟路径</param>
    /// <param name="myPartial">路径部分,右部分为文件名</param>
    /// <returns>指定部分</returns>
    private string getPageUrlPart(string pageUrl,string myPartial)
    {
    string strResult = "";
    if (pageUrl.Trim() != "")
    {
    string[] arrayItem = pageUrl.Split('/');
    if (myPartial.Trim().ToUpper() == "LEFT")
    {
    strResult = pageUrl.Replace(arrayItem[arrayItem.GetUpperBound(0)],"");
    }
    else if(myPartial.Trim().ToUpper() == "RIGHT")
    {
    strResult = arrayItem[arrayItem.GetUpperBound(0)];
    }
    }
    return strResult;
    }用法:
    string strVPath = this.getPageUrlPart(this.Request.ServerVariables["HTTP_REFERER"],"left");