protectedvoidbtnLogin_Click(object sender, EventArgs e) { var username = this.loginFormsUser.FindControl("UserName") as TextBox; var password = this.loginFormsUser.FindControl("password") as TextBox;
if (string.IsNullOrEmpty(username.Text)) { var error = this.loginFormsUser.FindControl("FailureText") as Label; error.Text = "请输入用户名"; return; } else { if (string.IsNullOrEmpty(password.Text)) { var error = this.loginFormsUser.FindControl("FailureText") as Label; error.Text = "请输入密码"; return; } }
try { SetFBACookie(HttpContext.Current.Request, username.Text, password.Text); var returnUrl = Request["ReturnUrl"]; Response.Redirect(returnUrl); } catch (Exception ex) { var label = this.loginFormsUser.FindControl("FailureText") as Label; label.Text = ex.ToString(); } }
protectedvoidbtnLogin_Click(object sender, EventArgs e) { var username = this.loginFormsUser.FindControl("UserName") as TextBox; var password = this.loginFormsUser.FindControl("password") as TextBox;
if (string.IsNullOrEmpty(username.Text)) { var error = this.loginFormsUser.FindControl("FailureText") as Label; error.Text = "请输入用户名"; return; } else { if (string.IsNullOrEmpty(password.Text)) { var error = this.loginFormsUser.FindControl("FailureText") as Label; error.Text = "请输入密码"; return; } }
try { SetFBACookie(HttpContext.Current.Request, username.Text, password.Text); var returnUrl = Request["ReturnUrl"]; Response.Redirect(returnUrl); } catch (Exception ex) { var label = this.loginFormsUser.FindControl("FailureText") as Label; label.Text = ex.ToString(); } }