protected void Page_Load(object sender, EventArgs e) { this.sessionId = this.Page.Request.QueryString["sessionId"]; if (!string.IsNullOrEmpty(this.sessionId)) { MemberInfo memberInfo = MemberProcessor.FindMemberBySessionId(this.sessionId); if (memberInfo == null) { base.Response.Redirect("SessionLogin?IsErrorSessionId=true"); } Users.SetCurrentUser(memberInfo.UserId, 30, true, false); } string text = base.Request.QueryString["returnUrl"]; if (!string.IsNullOrEmpty(text)) { base.Response.Redirect(Globals.UrlDecode(text)); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); MemberInfo memberInfo = HiContext.Current.User; if (HiContext.Current.UserId == 0) { string text = HttpContext.Current.Request["SessionId"].ToNullString(); if (!string.IsNullOrEmpty(text)) { memberInfo = MemberProcessor.FindMemberBySessionId(text); if (memberInfo == null) { HttpContext.Current.Response.Write("sessionid过期"); HttpContext.Current.Response.End(); } HiContext.Current.User = memberInfo; Users.SetCurrentUser(memberInfo.UserId, 30, true, false); } } DateTime now; if (memberInfo != null && memberInfo.UserId > 0) { HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Shop-Member"]; if (httpCookie != null) { HttpCookie httpCookie2 = httpCookie; now = DateTime.Now; httpCookie2.Expires = now.AddDays(30.0); HttpContext.Current.Response.Cookies.Add(httpCookie); } } if (memberInfo != null) { HttpCookie httpCookie3 = HiContext.Current.Context.Request.Cookies[AppshopMemberTemplatedWebControl.autoSetTags + "_" + memberInfo.UserId]; if (httpCookie3 == null) { IList <MemberTagInfo> list = MemberTagHelper.AutoTagsByMember(memberInfo.UserId, memberInfo.OrderNumber, memberInfo.Expenditure); if (list.Count > 0) { string text2 = memberInfo.TagIds; foreach (MemberTagInfo item in list) { if (string.IsNullOrEmpty(text2)) { text2 = text2 + "," + item.TagId + ","; } if (!("," + text2 + ",").Contains("," + item.TagId + ",")) { text2 = ((text2.LastIndexOf(",") != text2.Length - 1) ? (text2 + "," + item.TagId + ",") : (text2 + item.TagId + ",")); } } if (MemberTagHelper.UpdateSingleMemberTags(memberInfo.UserId, text2) > 0) { httpCookie3 = new HttpCookie(AppshopMemberTemplatedWebControl.autoSetTags + "_" + memberInfo.UserId); httpCookie3.HttpOnly = true; HttpCookie httpCookie4 = httpCookie3; now = DateTime.Now; httpCookie4.Expires = now.AddDays(1.0); httpCookie3.Value = Globals.UrlEncode(memberInfo.UserId.ToString()); HttpContext.Current.Response.Cookies.Add(httpCookie3); } } } } }
public void WriteTrafficRecords(HttpContext context) { context.Response.ContentType = "text/plain"; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; string text; DateTime date; if (context.Request.HttpMethod.ToLower() == "post") { num = context.Request["PageType"].ToInt(0); num2 = context.Request["SourceId"].ToInt(0); num5 = context.Request["StoreId"].ToInt(0); if (num >= 0 && num2 > 0 && num2 <= 99 && (num2 <= 3 || num2 >= 99) && num <= 99 && (num <= 3 || num >= 99)) { text = ""; Guid guid; DateTime now; if (num2 == 3) { string text2 = context.Request["SessionId"]; if (!string.IsNullOrWhiteSpace(text2)) { MemberInfo memberInfo = MemberProcessor.FindMemberBySessionId(text2); if (memberInfo == null) { guid = Guid.NewGuid(); text = guid.ToString().Replace("-", ""); HttpCookie httpCookie = new HttpCookie("t_sessionId"); httpCookie.HttpOnly = true; httpCookie.Value = text; HttpCookie httpCookie2 = httpCookie; now = DateTime.Now; httpCookie2.Expires = now.AddYears(1); HttpContext.Current.Response.Cookies.Add(httpCookie); context.Response.Write("error"); return; } text = memberInfo.UserId.ToString(); } else { try { int userId = HiContext.Current.UserId; if (userId > 0) { text = userId.ToString(); } } catch (Exception) { } } if (string.IsNullOrWhiteSpace(text)) { if (context.Request.Cookies.Get("t_sessionId") != null) { text = context.Request.Cookies.Get("t_sessionId").Value; } if (string.IsNullOrWhiteSpace(text)) { guid = Guid.NewGuid(); text = guid.ToString().Replace("-", ""); HttpCookie httpCookie3 = new HttpCookie("t_sessionId"); httpCookie3.HttpOnly = true; httpCookie3.Value = text; HttpCookie httpCookie4 = httpCookie3; now = DateTime.Now; httpCookie4.Expires = now.AddYears(1); HttpContext.Current.Response.Cookies.Add(httpCookie3); context.Response.Write("2"); return; } } } else if (HiContext.Current.UserId == 0) { if (context.Request.Cookies.Get("t_sessionId") != null) { text = context.Request.Cookies.Get("t_sessionId").Value; } if (string.IsNullOrWhiteSpace(text)) { guid = Guid.NewGuid(); text = guid.ToString().Replace("-", ""); HttpCookie httpCookie5 = new HttpCookie("t_sessionId"); httpCookie5.HttpOnly = true; httpCookie5.Value = text; HttpCookie httpCookie6 = httpCookie5; now = DateTime.Now; httpCookie6.Expires = now.AddYears(1); HttpContext.Current.Response.Cookies.Add(httpCookie5); context.Response.Write("2"); return; } } else { text = HiContext.Current.UserId.ToString(); } now = DateTime.Now; date = now.Date; int year = date.Year; int month = date.Month; int day = date.Day; if (3 == num) { num3 = context.Request["ProductId"].ToInt(0); num4 = context.Request["ActivityType"].ToInt(0); if (num4 > 0 && num4 <= 5 && (num4 != 4 || (num2 != 1 && num2 != 99)) && num3 > 0) { goto IL_04a0; } return; } goto IL_04a0; } return; } goto IL_0539; IL_0539: context.Response.Write("0"); return; IL_04a0: AccessRecordModel accessRecordModel = new AccessRecordModel(); accessRecordModel.AccessDate = date; accessRecordModel.IpAddress = text; accessRecordModel.PageType = num; accessRecordModel.SourceId = num2; accessRecordModel.ProductId = num3; accessRecordModel.ActivityType = num4; accessRecordModel.StoreId = num5; List <AccessRecordModel> list = (List <AccessRecordModel>)HiCache.Get("DataCache-AccessRecords"); if (list == null) { list = new List <AccessRecordModel>(); list.Add(accessRecordModel); HiCache.Insert("DataCache-AccessRecords", list, 3600); } else { list.Add(accessRecordModel); } goto IL_0539; }