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;
转载于:https://www.cnblogs.com/taiyonghai/p/5604266.html