void LoginControl_LoggedIn(object sender, EventArgs e) { if (this.IsValid) { UserAuditEvent evnt = new UserAuditEvent ( "user logged in", this, Monaco.Auditing.UserAuditTypes.UserLogin, (Guid)Membership.GetUser(LoginControl.UserName).ProviderUserKey ); evnt.Raise(); } else { ValidationHelper.SetFocusToFirstError(Page, "login"); } //Response.Write(UserAuditTypeFormat.Message(UserAuditTypes.UserLockedOut)); }
protected void SignupButton_Click(object sender, EventArgs e) { CaptchaCustomValidator.Validate(); //if (!CaptchaControl1.UserValidated) //{ //Session["UserLoginName"] = UserNameTextBox.Text.Trim(); //Session["UserEmail"] = EmailTextBox.Text.Trim(); //Session["UserFirstName"] = FirstNameTextBox.Text; //Session["UserLastName"] = LastNameTextBox.Text; //Response.AppendHeader("Refresh", "0;URL=" + Request.RawUrl); // Response.Redirect(Request.RawUrl); //} //else //{ if (this.Page.IsValid) { string username = UserNameTextBox.Text.Trim(); string email = EmailTextBox.Text.Trim(); string password = PasswordTextBox.Text.Trim(); string question = null; string answer = null; MembershipUser user = Membership.CreateUser ( username, password, email, question, answer, true, out _status ); Validate("signup_status"); if (IsValid) { Roles.AddUserToRoles(user.UserName, new string[] { "Member" }); ProfileCommon profile = Profile.GetProfile(user.UserName); profile.FirstName = FirstNameTextBox.Text; profile.LastName = LastNameTextBox.Text; profile.DateOfBirth = Picker.Date; profile.Sex = SexRadioButtonList.SelectedValue; profile.ShippingZipCode = ZipCodeTextBox.Text; profile.Browser = HttpContext.Current.Request.Browser.Browser + " " + HttpContext.Current.Request.Browser.MajorVersion; profile.IPAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); profile.LanguageCode = HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"].ToString(); profile.Timezone = TimeZone.CurrentTimeZone.StandardName.ToString(); profile.Save(); SignupMultiView.SetActiveView(SuccessView); SignupPanel.Update(); Subscriber subscriberInfo = new Subscriber(); subscriberInfo.FirstName = FirstNameTextBox.Text; subscriberInfo.LastName = LastNameTextBox.Text; subscriberInfo.Email = EmailTextBox.Text; subscriberInfo.SubscribedStatus = chkSubscribeNewsLetter.Checked; subscriberInfo.TotalEmailsSent = 0; Subscriber.ManageSubscription(subscriberInfo); UserAuditEvent evnt = new UserAuditEvent ( "user signed up ", this, Monaco.Auditing.UserAuditTypes.UserSignup, (Guid)user.ProviderUserKey ); /* clear view state maintaine manually */ //Session.Remove("UserLoginName"); //Session.Remove("UserEmail"); //Session.Remove("UserFirstName"); //Session.Remove("UserLastName"); evnt.Raise(); FormsAuthentication.RedirectFromLoginPage(user.UserName, false); Response.Redirect("~/Catalog/default.aspx?isnew=true"); } } else { //Response.Redirect(Request.RawUrl); ValidationHelper.SetFocusToFirstError(this, "signup"); } //} }
void SignupButton_ServerClick(object sender, EventArgs e) { if (this.Page.IsValid) { string username = UserNameTextBox.Text.Trim(); string email = EmailTextBox.Text.Trim(); string password = PasswordTextBox.Text.Trim(); string question = null; string answer = null; MembershipUser user = Membership.CreateUser ( username, password, email, question, answer, true, out _status ); Validate("signup_status"); if (this.Page.IsValid) { Roles.AddUserToRoles(user.UserName, new string[] { "Member" }); ProfileCommon profile = Profile.GetProfile(user.UserName); profile.FirstName = FirstNameTextBox.Text; profile.LastName = LastNameTextBox.Text; profile.DateOfBirth = DateTime.Parse(DateOfBirthTextBox.Text); profile.Sex = SexRadioButtonList.SelectedValue; //profile.ShippingZipCode = ZipCodeTextBox.Text; profile.Browser = HttpContext.Current.Request.Browser.Browser + " " + HttpContext.Current.Request.Browser.MajorVersion; profile.IPAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); profile.LanguageCode = HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"].ToString(); profile.Timezone = TimeZone.CurrentTimeZone.StandardName.ToString(); profile.Save(); //SignupMultiView.SetActiveView(SuccessView); //SignupPanel.Update(); Subscriber subscriberInfo = new Subscriber(); subscriberInfo.FirstName = FirstNameTextBox.Text; subscriberInfo.LastName = LastNameTextBox.Text; subscriberInfo.Email = EmailTextBox.Text; subscriberInfo.SubscribedStatus = true; subscriberInfo.TotalEmailsSent = 0; Subscriber.ManageSubscription(subscriberInfo); UserAuditEvent evnt = new UserAuditEvent ( "user signed up", this, Monaco.Auditing.UserAuditTypes.UserSignup, (Guid)user.ProviderUserKey ); /* clear view state maintaine manually */ //Session.Remove("UserLoginName"); //Session.Remove("UserEmail"); //Session.Remove("UserFirstName"); //Session.Remove("UserLastName"); evnt.Raise(); FormsAuthentication.RedirectFromLoginPage(user.UserName, false); Response.Redirect(this.Page.Request.RawUrl); } } }