protected void RegisterUser_CreatedUser(object sender, EventArgs e) { FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */); bool isStudent = true; string firstName = (RegisterUser.FindControl("CreateUserStepContainer").FindControl("TextBoxFirstName") as TextBox).Text; string lastName = (RegisterUser.FindControl("CreateUserStepContainer").FindControl("TextBoxLastName") as TextBox).Text; // TO MAKE THIS DATA DRIVEN string studentOrTeacher = (RegisterUser.FindControl("CreateUserStepContainer").FindControl("DropDownListTeacherStudent") as DropDownList).SelectedItem.ToString(); if (studentOrTeacher == "Teacher") { isStudent = false; } DaLogin daLogin = new DaLogin(); string error = daLogin.CreateUser(RegisterUser.UserName, RegisterUser.Password, isStudent, firstName, lastName); string continueUrl = RegisterUser.ContinueDestinationPageUrl; if (String.IsNullOrEmpty(continueUrl)) { continueUrl = "~/"; } Response.Redirect(continueUrl); }
void LoginUser_LoggingIn(object sender, LoginCancelEventArgs e) { string userName = this.LoginUser.UserName; string password = this.LoginUser.Password; DaLogin daLogin = new DaLogin(); DataTable dtResults = daLogin.Login(userName, password); if (dtResults.Rows.Count == 1) { //login verified FormsAuthentication.RedirectFromLoginPage(userName, true); } /******javascript will take care of alert of bad password/username*******/ }