怎样得到虚拟目录的物理路径?(如:我的网站放在 d:\Dir1\MyWeb\ 下面) 我怎样得到这个路径(用这个吗:server.MapPath(??) ??)
--------------
解决立即结帐!1

解决方案 »

  1.   

    Request.PhysicalPath()
            Request.PhysicalApplicationPath()
      

  2.   

    Request.PhysicalApplicationPathServer.MapPath()试试便知.
      

  3.   

    Server.MapPath()可以得到物理路径!!!
      

  4.   

    我是在global.cs中访问的
    -------------------------: 
    Request.PhysicalPath()
            Request.PhysicalApplicationPath()
    -------------------------------------------
    上面方法出现上下文不可用。
      

  5.   

    global.cs中,在Application事件中,无法得到request事件。所以你如果要在这里使用,恐怕还只能用server.mappath
    折衷的方法是在Session_Start事件里面求取。虽然非一次性获取,但也还算不怎么耗费资源。