pratibha14
Technical User
- Mar 2, 2004
- 30
hi,
From windows form application I can create new user on local machine without problem. But when I try to create new user in web application there is an error "System.UnauthorizedAccessException:General access denied error at System.DirectoryServices.Interop.IAds.SetInfo() at System.DirectoryServices.DirectoryEntry.CommitChanges()
code is
DirectoryEntry de = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
DirectoryEntry newUser = de.Children.Add("TestUser1", "User");
newUser.Password = pwd;
newUser.CommitChanges();
DirectoryEntry grp = de.Children.Find("Guests", "group");
if (grp.Name != "")
{
grp.Invoke("Add", (object)newUser.Path.ToString());
}
Any Suggestions?
Thanks
Pratibha
From windows form application I can create new user on local machine without problem. But when I try to create new user in web application there is an error "System.UnauthorizedAccessException:General access denied error at System.DirectoryServices.Interop.IAds.SetInfo() at System.DirectoryServices.DirectoryEntry.CommitChanges()
code is
DirectoryEntry de = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
DirectoryEntry newUser = de.Children.Add("TestUser1", "User");
newUser.Password = pwd;
newUser.CommitChanges();
DirectoryEntry grp = de.Children.Find("Guests", "group");
if (grp.Name != "")
{
grp.Invoke("Add", (object)newUser.Path.ToString());
}
Any Suggestions?
Thanks
Pratibha