string mServerUrl ="";
if (System.Web.HttpRuntime.AppDomainAppVirtualPath == "/")
                mServerUrl = "http://" + Request.ServerVariables["HTTP_HOST"] + "/Web/";
            else
                mServerUrl = "http://" + Request.ServerVariables["HTTP_HOST"] + System.Web.HttpRuntime.AppDomainAppVirtualPath + "/Web/" ;
试试

解决方案 »

  1.   

    多谢楼上,但这里的Web是可变的
      

  2.   

    Server.MapPath("文件名");
    这就是当前路径了
      

  3.   

    不防试试:  string url = HttpContext.Current.Request.Url.ToString ();
            url = url.Substring(0,url.LastIndexOf("/") + 1);        Response.Write(url);
      

  4.   

    用楼上只能得到
    E:\PAGE\TT_BASE\Web\Default.aspx 我要的是这样的http://127.0.0.1/Web/ 
    同样感谢,继续等答案
      

  5.   

    HttpContext.Current.Request.Url.Host.ToString();(127.0.0.1)
    HttpContext.Current.Request.Url.Port.ToString();(端口)
    HttpRuntime.AppDomainAppVirtualPath;(虚拟目录Web)
    组合起来就是你要的结果了