惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
V
V2EX
Jina AI
Jina AI
爱范儿
爱范儿
M
MIT News - Artificial intelligence
量子位
L
LangChain Blog
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
腾讯CDC
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss

博客园 - 火龙sky

ASP.NET Ajax发布时异步刷新失效的问题解决方法 关于Tomcat虚拟主机域名的设置--设置本地主机域名 Sql Server 中一个非常强大的日期格式化函数 针对sql 2005优化的高性能分页存储过程 大型网站架构设计 在ASP.NET中记录错误日志(使用Global.asax) 一个完美的的项目经理 CuteEditor6.0 使用 CE寻找游戏基址+偏移 VirtualAllocEx函数 了解游戏外挂 c#做外挂 step by step(更新至step3:注入) Sql-Server应用程序的高级Sql注入 教程: 汇编语言的准备知识-给初次接触汇编者4 教程: 汇编语言的准备知识-给初次接触汇编者3 教程: 汇编语言的准备知识-给初次接触汇编者2 汇编语言的准备知识--给初次接触汇编者 1 邮件简单发送 设置HtmlMeta 值
GetIP cookies
火龙sky · 2008-10-23 · via 博客园 - 火龙sky

        #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;
        }