#region 设置Cookies值                        SetCookies(string cookiesname, string cookiesvalue, int Expirestime)
        /// <summary>
        /// 设置Cookies值
        /// </summary>
        /// <param name="cookiesname">名称</param>
        /// <param name="cookiesvalue">内容</param>
        /// <param name="Expirestime">过期时间,0表示默认过期时间</param>
        public static void SetCookies(string cookiesname, string cookiesvalue, int Expirestime)
        {
            HttpContext.Current.Response.Cookies[cookiesname].Value = cookiesvalue;
            if (Expirestime != 0)
                HttpContext.Current.Response.Cookies[cookiesname].Expires = DateTime.Now.AddDays(Expirestime);
        }
        #endregion

        #region 取Cookies值                          string GetCookies(string cookiesname)
        public static string GetCookies(string cookiesname)
        {
            string obj = string.Empty;
            try
            {
                return HttpContext.Current.Request.Cookies[cookiesname].Value;
            }
            catch
            {
                return obj;
            }
        }
        #endregion

 

 

        public static string GetIPAddress()
        {

            string user_IP = string.Empty;
            if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
            {
                if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
                {
                    user_IP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
                }
                else
                {
                    user_IP = System.Web.HttpContext.Current.Request.UserHostAddress;
                }
            }
            else
            {
                user_IP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
            }
            return user_IP;
        }