/// <summary> /// Handles the RowDeleting event of the grid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param> void grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string username = (string)gridUsers.DataKeys[e.RowIndex].Value; string[] roles = Roles.GetRolesForUser(username); Membership.DeleteUser(username); if (roles.Length > 0) { Roles.RemoveUserFromRoles(username, roles); } AuthorProfile profile = AuthorProfile.GetProfile(username); if (profile != null) { profile.Delete(); } if (HttpContext.Current.User.Identity.Name.Equals(username, StringComparison.OrdinalIgnoreCase)) { FormsAuthentication.SignOut(); } Response.Redirect(Request.RawUrl); }