代码
public static string GetUrlRoot()
        {
            
string strTemp=""
            
if(System.Web.HttpContext.Current.Request.ServerVariables["HTTPS"== "off"
            { 
                strTemp 
= "http://"
            } 
            
else 
            { 
                strTemp 
= "https://"
            } 

            strTemp 
= strTemp + System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"]; 

            
if(System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT"!= "80"
            { 
                strTemp 
= strTemp + ":" + System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT"]; 
            } 
            
return strTemp;
        }

 

相关文章:

  • 2021-08-16
  • 2021-06-20
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2021-07-20
  • 2021-06-05
  • 2021-12-12
相关资源
相似解决方案