this.TextBox1.Text = Server.MapPath("WebForm1.aspx");

解决方案 »

  1.   

    Console.Write( Server.MapPath("WebForm1.aspx"));
      

  2.   

    lblPath.Text = Request.PhysicalApplicationPath;
    //获取当前正在执行的服务器应用程序的根目录的物理文件系统路径。
      

  3.   

    DirectoryEntry rootfolder = new DirectoryEntry("IIS://LocalHost/W3SVC/1/ROOT/mywebsite1"); 
    rootfolder.Properties["Path"];
    我用上面的方法取不出dotnet建的虚拟目录,能取出其它的路径