protected override void OnInit(EventArgs e) { base.OnInit(e); string text = this.Page.Request.QueryString["action"].ToNullString(); MemberInfo user = HiContext.Current.User; string text2 = Globals.UrlDecode(HttpContext.Current.Request.QueryString["ReturnUrl"]); if (string.IsNullOrEmpty(text2)) { text2 = HttpContext.Current.Request.Url.ToString(); } DateTime now; if (user != null && user.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 (!user.CellPhoneVerification) { string text3 = HttpContext.Current.Request.Url.ToString().ToLower(); if (text3.IndexOf("/bindphone") == -1) { if (MemberProcessor.IsTrustLoginUser(user) && HiContext.Current.SiteSettings.QuickLoginIsForceBindingMobbile) { HttpContext.Current.Response.Redirect("BindPhone"); } else if (HiContext.Current.SiteSettings.UserLoginIsForceBindingMobbile) { HttpContext.Current.Response.Redirect("BindPhone"); } } } } if (user.UserId == 0 || (user.UserId != 0 && !user.IsLogined)) { string query = HttpContext.Current.Request.Url.Query; query = ((string.IsNullOrEmpty(query) || !query.StartsWith("?")) ? "" : ("&" + query.Substring(1))); if (base.ClientType == ClientType.VShop) { OAuthUserInfo oAuthUserInfo = base.GetOAuthUserInfo(true); if (!this.HasLogin(oAuthUserInfo.OpenId, oAuthUserInfo.unionId, oAuthUserInfo.IsAttention)) { if (!string.IsNullOrEmpty(oAuthUserInfo.OpenId)) { HttpCookie httpCookie3 = new HttpCookie("openId"); httpCookie3.HttpOnly = true; httpCookie3.Value = oAuthUserInfo.OpenId; httpCookie3.Expires = DateTime.MaxValue; HttpContext.Current.Response.Cookies.Add(httpCookie3); } string text4 = Globals.UrlEncode(oAuthUserInfo.HeadImageUrl.ToNullString()); bool isAttention; if (!string.IsNullOrEmpty(oAuthUserInfo.NickName)) { if (string.IsNullOrEmpty(text)) { HttpResponse response = this.Page.Response; string[] obj = new string[12] { "/Vshop/Login?openId=", oAuthUserInfo.OpenId, "&headimage=", text4, "&nickname=", oAuthUserInfo.NickName, "&IsSubscribe=", null, null, null, null, null }; isAttention = oAuthUserInfo.IsAttention; obj[7] = isAttention.ToString(); obj[8] = "&unionId="; obj[9] = oAuthUserInfo.unionId; obj[10] = query; obj[11] = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2))); response.Redirect(string.Concat(obj)); } else { HttpResponse response2 = this.Page.Response; string[] obj2 = new string[14] { "/Vshop/Login.aspx?action=", text, "&openId=", oAuthUserInfo.OpenId, "&headimage=", text4, "&nickname=", oAuthUserInfo.NickName, "&IsSubscribe=", null, null, null, null, null }; isAttention = oAuthUserInfo.IsAttention; obj2[9] = isAttention.ToString(); obj2[10] = "&unionId="; obj2[11] = oAuthUserInfo.unionId; obj2[12] = query; obj2[13] = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2))); response2.Redirect(string.Concat(obj2)); } } else if (string.IsNullOrEmpty(text)) { HttpResponse response3 = this.Page.Response; string[] obj3 = new string[10] { "/Vshop/Login?openId=", oAuthUserInfo.OpenId, "&IsSubscribe=", null, null, null, null, null, null, null }; isAttention = oAuthUserInfo.IsAttention; obj3[3] = isAttention.ToString(); obj3[4] = "&headimage="; obj3[5] = text4; obj3[6] = "&unionId="; obj3[7] = oAuthUserInfo.unionId; obj3[8] = query; obj3[9] = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2))); response3.Redirect(string.Concat(obj3)); } else { HttpResponse response4 = this.Page.Response; string[] obj4 = new string[12] { "/Vshop/Login?action=", text, "&openId=", oAuthUserInfo.OpenId, "&headimage=", text4, "&IsSubscribe=", null, null, null, null, null }; isAttention = oAuthUserInfo.IsAttention; obj4[7] = isAttention.ToString(); obj4[8] = "&unionId="; obj4[9] = oAuthUserInfo.unionId; obj4[10] = query; obj4[11] = ((query.IndexOf("returnUrl") > -1) ? "" : ("&returnUrl=" + Globals.UrlEncode(text2))); response4.Redirect(string.Concat(obj4)); } } } else if (string.IsNullOrEmpty(text)) { this.Page.Response.Redirect("Login?returnUrl=" + HttpUtility.UrlEncode(text2), true); } else { this.Page.Response.Redirect("Login?action=" + text + "&returnUrl=" + HttpUtility.UrlEncode(text2), true); } } else { HttpCookie httpCookie4 = HiContext.Current.Context.Request.Cookies[WAPMemberTemplatedWebControl.autoSetTags + "_" + user.UserId]; if (httpCookie4 == null) { IList <MemberTagInfo> list = MemberTagHelper.AutoTagsByMember(user.UserId, user.OrderNumber, user.Expenditure); if (list.Count > 0) { string text5 = user.TagIds; foreach (MemberTagInfo item in list) { if (string.IsNullOrEmpty(text5)) { text5 = text5 + "," + item.TagId + ","; } if (!("," + text5 + ",").Contains("," + item.TagId + ",")) { text5 = ((text5.LastIndexOf(",") != text5.Length - 1) ? (text5 + "," + item.TagId + ",") : (text5 + item.TagId + ",")); } } if (MemberTagHelper.UpdateSingleMemberTags(user.UserId, text5) > 0) { httpCookie4 = new HttpCookie(WAPMemberTemplatedWebControl.autoSetTags + "_" + user.UserId); httpCookie4.HttpOnly = true; HttpCookie httpCookie5 = httpCookie4; now = DateTime.Now; httpCookie5.Expires = now.AddDays(1.0); httpCookie4.Value = Globals.UrlEncode(user.UserId.ToString()); HttpContext.Current.Response.Cookies.Add(httpCookie4); } } } HttpCookie httpCookie6 = HiContext.Current.Context.Request.Cookies["openId"]; if (httpCookie6 != null && !string.IsNullOrEmpty(httpCookie6.Value)) { lock (this.lockCopyRedEnvelope) { this.CopyRedEnvelope(httpCookie6.Value, user); } } } }
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); } } } } }
protected MemberTemplatedWebControl() { MemberInfo user = HiContext.Current.User; if (HiContext.Current.User.UserId == 0) { this.Page.Response.Redirect($"/User/login?ReturnUrl={this.Page.Request.RawUrl}", true); } DateTime now; if (user != null && user.UserId > 0) { HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["PC-Member"]; if (httpCookie != null) { HttpCookie httpCookie2 = httpCookie; now = DateTime.Now; httpCookie2.Expires = now.AddMinutes(30.0); HttpContext.Current.Response.Cookies.Add(httpCookie); } if (!user.CellPhoneVerification) { string text = HttpContext.Current.Request.Url.ToString().ToLower(); if (text.IndexOf("/user/usercellphoneverification") == -1) { if (MemberProcessor.IsTrustLoginUser(user) && HiContext.Current.SiteSettings.QuickLoginIsForceBindingMobbile) { HttpContext.Current.Response.Redirect("/User/UserCellPhoneVerification"); } else if (HiContext.Current.SiteSettings.UserLoginIsForceBindingMobbile) { HttpContext.Current.Response.Redirect("/User/UserCellPhoneVerification"); } } } } if (user != null) { HttpCookie httpCookie3 = HiContext.Current.Context.Request.Cookies[MemberTemplatedWebControl.autoSetTags + "_" + user.UserId]; if (httpCookie3 == null) { IList <MemberTagInfo> list = MemberTagHelper.AutoTagsByMember(user.UserId, user.OrderNumber, user.Expenditure); if (list.Count > 0) { string text2 = user.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(user.UserId, text2) > 0) { httpCookie3 = new HttpCookie(MemberTemplatedWebControl.autoSetTags + "_" + user.UserId) { HttpOnly = true }; HttpCookie httpCookie4 = httpCookie3; now = DateTime.Now; httpCookie4.Expires = now.AddDays(1.0); httpCookie3.Value = Globals.UrlEncode(user.UserId.ToString()); HttpContext.Current.Response.Cookies.Add(httpCookie3); } } } } }