Example #1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string usr = WebSecurity.CurrentUserName;

            if (!string.IsNullOrEmpty(txtPassword.Text))
            {
                if (Membership.ValidateUser(usr, txtPassword.Text))
                {
                    ProviderDAC dac    = new ProviderDAC();
                    Guid        userID = dac.RetrieveUserGUID(usr);
                    string      err    = "";
                    if (dac.DeactivateUser(usr, userID, out err))
                    {
                        accountCancel.Visible   = false;
                        CompleteConfirm.Visible = true;
                    }
                    else
                    {
                        lblError.Visible = true;
                        if (err == "Unable to find user")
                        {
                            lblError.Text = "Unknown error, please retry login";
                        }
                    }
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = "Invalid password";
                }
            }
        }