/// <summary> /// 注册按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRegister_Click(object sender, EventArgs e) { if (TextUtility.EmptyTrimOrNull(txtAccounts.Text.Trim()) || TextUtility.EmptyTrimOrNull(txtLogonPass.Text.Trim())) { Show("抱歉!您输入的用户名或密码错误了。"); this.txtAccounts.Focus(); return; } //验证码错误 if (!txtCode.Text.Trim().Equals(Fetch.GetVerifyCode(), StringComparison.InvariantCultureIgnoreCase)) { Show("抱歉!您输入的验证码错误了。"); this.txtAccounts.Focus(); return; } Message umsg = accountsFacade.IsAccountsExist(CtrlHelper.GetText(txtAccounts)); if (!umsg.Success) { Show(umsg.Content); this.txtAccounts.Focus(); return; } UserInfo user = new UserInfo(); user.Accounts = CtrlHelper.GetText(txtAccounts); user.Compellation = CtrlHelper.GetText(txtCompellation); user.FaceID = Convert.ToInt16(hfFaceID.Value.Trim()); user.Gender = Convert.ToByte(ddlGender.SelectedValue); user.InsurePass = TextEncrypt.EncryptPassword(CtrlHelper.GetText(txtInsurePass1)); user.LastLogonDate = DateTime.Now; user.LastLogonIP = GameRequest.GetUserIP(); user.LogonPass = TextEncrypt.EncryptPassword(CtrlHelper.GetText(txtLogonPass)); user.NickName = CtrlHelper.GetText(txtNickname); user.PassPortID = CtrlHelper.GetText(txtPassPortID); user.RegisterDate = DateTime.Now; user.RegisterIP = GameRequest.GetUserIP(); Message msg = accountsFacade.Register(user, CtrlHelper.GetText(txtSpreader)); if (msg.Success) { UserInfo ui = msg.EntityList[0] as UserInfo; ui.LogonPass = TextEncrypt.EncryptPassword(CtrlHelper.GetText(txtLogonPass)); Fetch.SetUserCookie(ui.ToUserTicketInfo( )); ShowAndRedirect("注册成功!", "/Member/MIndex.aspx"); } else { Show(msg.Content); this.txtAccounts.Focus(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string Accounts = context.Request.Params["Ilogname"]; string NickName = context.Request.Params["InickName"]; //string Compellation = context.Request.Params["Iname"]; string LogonPass = context.Request.Params["Ipwd"]; //string PassPortID = context.Request.Params["Iid"]; string Spreader = context.Request.Params["Ispre"]; UserInfo user = new UserInfo(); user.Accounts = Accounts; user.Compellation = ""; //user.FaceID = Convert.ToInt16(hfFaceID.Value.Trim()); // user.Gender = Convert.ToByte(ddlGender.SelectedValue); user.InsurePass = TextEncrypt.EncryptPassword(LogonPass); user.LastLogonDate = DateTime.Now; user.LastLogonIP = GameRequest.GetUserIP(); user.LogonPass = TextEncrypt.EncryptPassword(LogonPass); user.NickName = NickName; user.PassPortID = ""; user.RegisterDate = DateTime.Now; user.RegisterIP = GameRequest.GetUserIP(); string strType = ""; if (System.Web.HttpContext.Current.Request.Cookies["asd"] != null) { strType = System.Web.HttpContext.Current.Request.Cookies["asd"].Value.ToString(); } int nType = 8; if (strType == "2") { nType = 2; } else if (strType == "5") { nType = 5; } Message msg = accountsFacade.Register(user, Spreader, nType); if (msg.Success) { UserInfo ui = msg.EntityList[0] as UserInfo; ui.LogonPass = TextEncrypt.EncryptPassword(LogonPass); Fetch.SetUserCookie(ui.ToUserTicketInfo()); context.Response.Write("success"); } else { context.Response.Write(msg.Content); } }