Ejemplo n.º 1
0
        private static void RecordUserAgent(object agent0)
        {
            String agent = agent0 as String;

            UserAgent.AddIteam(agent, "");    // 记录UserAgent信息

            //String agent = agent0 as String;
            //if (agent != null && !agent.Equals(""))
            //{
            //    string agentKey = "\"信息\":\"" + agent + "\"";

            //    string md5 = MD5.Encrypt(agent);                                            // 计算md5值
            //    string md5Key = "\"标签\":\"" + md5 + "\"";

            //    string value = WebInfo.Get("HttpUserAgent", md5);                           // 查询已保存的值

            //    //[{"日期":"2018-10-30_20:00:47_407124","标签":"9d6e5576531c38953e05804e13fa8e74","信息":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"},{"日期":"2018-10-30_20:01:31_604507","标签":"9d6e5576531c38953e05804e13fa8e74","信息":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"}]


            //    if (!value.Contains(md5Key)) WebInfo.Set(UserAgentTable, md5, agent);              // 若不存在,则添加
            //    else if (!value.Contains(agentKey)) WebInfo.Update(UserAgentTable, md5, agent);    // 修改已保存的数据
            //}
        }