string strServer = "http://" + Request.ServerVariables["SERVER_NAME"].ToString();
 string strPort = ":" + Convert.ToString(Request.ServerVariables["SERVER_PORT"]);
 string strRoot = Request.ApplicationPath + "/";
 if (strPort.Trim() == ":80")
 {
      strPort = "";
 }
 string strUrl = strServer + strPort + strRoot;

相关文章: