c#的webform从虚拟目录得到物理目录很容易,
但在c#的winform中,如何从一个虚拟路径得到物理路径?

解决方案 »

  1.   

    c#的winform中有虚拟路径一说吗
      

  2.   

    server.mappath()返回的是主目录的地址
    我的主目录在c:\inetpub\wwwroot
    而虚拟目录upload指向的是d:\upload
    server.mappath("upload") 返回的是c:\inetpub\wwwroot\upload
      

  3.   

    用:
    System.Web.HttpContext.Current.Server.MapPath("虚拟目录名");
    就可以了。
      

  4.   

    System.Web.HttpContext.Current.Server.MapPath("虚拟目录名");
      

  5.   

    winform/webform:
    Request.ApplicationPath 
    webform:
    HttpContext.Current.Server.MapPath();
      

  6.   

    楼主说的问题好像不对吧,不过下面的老大们都把问题给解决了,上面回复完全可以解决楼主的问题了,哈哈
    server.mappath();
      

  7.   

    DirectoryEntry dir = new DirectoryEntry("IIS://localhost/W3SVC/1/Root/"+_virtulDir);
    _physicalDir = dir.Properties["Path"].Value.ToString();