Пример #1
0
    protected void CreateUser_Click(object sender, EventArgs e)
    {
        try
        {
            GraffitiUsers.CreateUser(Server.HtmlEncode(txtUserName.Text.Trim()), txtPassword.Text.Trim(), txtEmail.Text.Trim(), GraffitiUsers.EveryoneRole);

            Response.Redirect("~/graffiti-admin/user-management/users/?user="******"&new=true");
        }
        catch (Exception ex)
        {
            string exMessage = ex.Message;
            if (!string.IsNullOrEmpty(exMessage) && exMessage.IndexOf("UNIQUE") > -1)
            {
                exMessage = "This user (or email) already exists.";
            }

            Message.Text = "A name or email with the name of " + txtUserName.Text + " could not be created.<br />" +
                           exMessage;
            Message.Type = StatusType.Error;
        }
    }