protected void btnRegister_Click(object sender, EventArgs e)
        {
            UserManager s = new UserManager();
            List<string> errors = s.CreateUser(txtUser.Text, txtPassword.Text, txtEmail.Text, txtQuestion.Text, txtAnswer.Text, "", int.Parse(DropDownList1.SelectedValue));

            lblRegErrors.Text = "<ul>";
            foreach (string error in errors)
                lblRegErrors.Text += string.Format("<li>{0}</li>", error);
            lblRegErrors.Text += "</ul>";

            if (!IsPostBack)
            {
                Response.Redirect(ViewState["PreviousPage"].ToString());
            }
        }
Esempio n. 2
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     UserManager s = new UserManager();
     if (s.Login(txtUserName.Text, txtPassword.Text) && (string)ViewState["PreviousPage"] != null)
     {
         Response.Redirect((string)ViewState["PreviousPage"]);
     }
     else if (s.Login(txtUserName.Text, txtPassword.Text) && (string)ViewState["PreviousPage"] == null)
     {
         Response.Redirect(@"/Index.aspx");
     }
     else
     {
         FailureText.Text = "User not found";
     }
 }