I have this code:
The EnsureUser Line is throwing me that exception, any idea?
The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.
samAccountNames = GetSamAccountNamesToRemove(FindUsernames(membergroup), ppePeople2.GetSamAccountNames());
try
{
// Get the distinguished name for the usernames that should be removed from the (Member) AD Group and remove from the group
foreach (string username in samAccountNames)
{
string userdn = GetObjectDistinguishedName("user", username);
RemoveFromGroup(userdn, groupdn);
if (!string.IsNullOrEmpty(username))
{
SPUser user = UpdateCurrentweb.EnsureUser(domain + "\\" + username);
string group = "Member";
int UserListID = UserAccessID(WorkspaceAccessList, user.Name, group);
SPListItem item = WorkspaceAccessList.GetItemById(UserListID);
UpdateCurrentweb.AllowUnsafeUpdates = true;
item.Delete();
UpdateCurrentweb.AllowUnsafeUpdates = false;
}