Request.Path
不行!高手再帮帮我!谢谢!!!

解决方案 »

  1.   

    如我又一个虚拟目录aa,用户浏览aa/bb/index.htm时,我如何得到虚拟目录aa所在的物理路径!谢谢!!!
      

  2.   

    public string getCurrentPhyUrl()
    {
    string[] arrRequestFileName = ( string[] ) System.Web.HttpContext.Current.Request.PhysicalPath.ToString().Trim().Split( '\\' );
    int RequestFileNameLen = arrRequestFileName[ arrRequestFileName.GetUpperBound( 0 ) ].ToString().Length;
    int intStart = System.Web.HttpContext.Current.Request.PhysicalPath.ToString().Trim().Length - RequestFileNameLen;
    string  RequestPhyURL = System.Web.HttpContext.Current.Request.PhysicalPath.ToString().Remove( intStart, RequestFileNameLen );
    return RequestPhyURL;
    }
      

  3.   

    gOODiDEA(无语):为什么会有'\\'
    string[] arrRequestFileName = ( string[] ) System.Web.HttpContext.Current.Request.PhysicalPath.ToString().Trim().Split( '\\' );谢谢!!!
      

  4.   

    回复人: foreveryouth() ( ) 信誉:100  2003-05-06 15:34:00  得分:0 
      如我又一个虚拟目录aa,用户浏览aa/bb/index.htm时,我如何得到虚拟目录aa所在的物理路径!谢谢!!!
      你可以试试:
     Request.MapPath("bb\\index.htm")
      

  5.   

    一位高人告诉我了是:Request.PhysicalApplicationPath
      

  6.   

    试试这个:
    Dim WebDir As String = Request.ServerVariables("appl_physical_path")
    Label1.Text = WebDir