zoukankan      html  css  js  c++  java
  • C#获取页面URL地址

            #region 获取页面地址
            
    /// <summary>
            
    /// 获取页面地址
            
    /// </summary>
            
    /// <returns></returns>
            public static string GetUrl()
            {
                
    //  2009年12月15日 11:45:24
                
    //  B哥 kuibono@163.com
                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"];
                }

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

                
    if (System.Web.HttpContext.Current.Request.QueryString.AllKeys.Length>0)
                {
                    strTemp 
    = strTemp + "?" + System.Web.HttpContext.Current.Request.QueryString;
                }

                
    return strTemp;
            }
            
    string myurl = GetUrl(); 
            
    #endregion
  • 相关阅读:
    面试题:redis事务
    哲学家就餐问题
    面试题:Redis常见性能问题和解决方案?
    取势、明道、优术、践行、合众
    自主可控和开源
    关于独立思考
    警惕软件复杂度困局
    如何构建研发体系
    大数据整体链路
    银行数仓的建设实践
  • 原文地址:https://www.cnblogs.com/kuibono/p/1624627.html
Copyright © 2011-2022 走看看