- if (assort.Equals(0))
- {
- ly = Request.QueryString["Ly"]; //获取来源URL
- currWeb = Request.QueryString["CurrWeb"]; //获取当前URL
- }
- else
- {
- ly = Request.ServerVariables["Http_Referer"];
- currWeb = ly;
- }
- string firstShow = Request.QueryString["FirstShow"]; //是否第一次访问
- string visitTotal = Request.QueryString["VisitTotal"]; //获取浏览次数
- string ip = Helper.Utils.ClientIP(); //获取客户端IP地址
- string strAgent = Request.ServerVariables["HTTP_USER_AGENT"];
- bool isAlexa = false;
- if (strAgent.IndexOf("alexa") >-1) //判断是否安装alexa工具栏
- isAlexa = true;
- string browerName = Request.Browser.Browser; //浏览器名称
- string browerVersion = Request.Browser.Version; //浏览器版本
- string os = Helper.Utils.GetClientOS(); //客户端操作系统
- string langage = Helper.Utils.GetLangage(); //客户端语言
- string spider = Helper.Utils.GetSpiderBot(); //搜索引擎爬虫信息
- bool isSpider = false;
- if (!string.IsNullOrEmpty(spider))
- isSpider = true;
- HttpContext.Application.Lock();
- ClickDataAccess clientBasic = new ClickDataAccess();
- //刷新操作 需要根据上一个地址和当前地址 来判断
- if (HttpContext.Application["HBCurrWeb_" + SiteID] != null
- &&HttpContext.Application["HBCurrWeb_" + SiteID].ToString().Equals(currWeb)
- &&HttpContext.Application["HBLy_" + SiteID] != null
- &&HttpContext.Application["HBLy_" + SiteID].ToString().Equals(ly)
- &&HttpContext.Application["HBClientId_" + SiteID] != null)
- {
- clientBasic.UpdateForRefresh(HttpContext.Application["HBClientId_" + SiteID]);
- //Helper.Utils.CreateFile("~/Log/", DateTime.Now.ToString("yyyyMMddHHmmssffff") + "_" + SiteID + "刷新.txt", writetext.ToString());
- }
- else
- {
- if (HttpContext.Application["HBClientId_" + SiteID] != null) //如果存在上一个页面的ID值则写入离开时间
- clientBasic.UpdateForLeaveTime(HttpContext.Application["HBClientId_" + SiteID]);
- ClickAndVisitorsDataAccess clientData = new ClickAndVisitorsDataAccess();
- string[] outParam = clientData.Save(client);
- if (!string.IsNullOrEmpty(outParam[0]))
- HttpContext.Application["HBPublicId_" + SiteID] = outParam[0];
- if (!string.IsNullOrEmpty(outParam[1]))
- {
- HttpContext.Application["HBClientId_" + SiteID] = outParam[1];
- javaScript = "WriteCookie(''HBClientIDCookie''," + int.Parse(outParam[1]) + ");";
- }
- HttpContext.Application["HBCurrWeb_" + SiteID] = currWeb;
- HttpContext.Application["HBLy_" + SiteID] = ly;
- }
- HttpContext.Application.UnLock();
- #endregion
这