string strSiteUrl = myUri.Scheme+"://"+myUri.Host+":"+myUri.Port.ToString()+Request.ApplicationPath;

解决方案 »

  1.   

    这样的 
    Uri myUri = Request.Url;
    //获得当前站点及其应用程序路径
    string strSiteUrl = myUri.Scheme+"://"+myUri.Host+":"+myUri.Port.ToString()+Request.ApplicationPath;
    再加上你取
      

  2.   

    用这个:string hostStr=ParentPage.Request.Url.Host;
      

  3.   

    Page.Request.ServerVariables["SCRIPT_NAME"]
      

  4.   

    Page.Request.ServerVariables是一个类似Hashtable的一个东西。你可以用下面的代码查看里面的内容。
    int loop1, loop2;
    NameValueCollection coll;
     
    // Load ServerVariable collection into NameValueCollection object.
    coll=Request.ServerVariables; 
    // Get names of all keys into a string array. 
    String[] arr1 = coll.AllKeys; 
    for (loop1 = 0; loop1 < arr1.Length; loop1++) 
    {
       Response.Write("Key: " + arr1[loop1] + "<br>");
       String[] arr2=coll.GetValues(arr1[loop1]);
       for (loop2 = 0; loop2 < arr2.Length; loop2++) {
          Response.Write("Value " + loop2 + ": " + arr2[loop2] + "<br>");
       }
    }
      

  5.   

    Application.StartupPath
    /获得初始路径/
    Environment.CurrentDirectory
    /获得当前目录/Request.Path
    /获取当前的虚拟路径/
    "http://" + Request.ServerVariables["HTTP_HOST"] + Request.ServerVariables["SCRIPT_NAME"]
    /获取整个http路径/