J
johnpremi
Hi there,
I have a web app that adds user into w2k3 server and adds it to the
administrator group. The code snippet is something like this:
try
{
DirectoryEntry AD = new DirectoryEntry("WinNT://" +
in0.IPAddress + ",computer", in1.userName, decryptData(in1.password),
AuthenticationTypes.Secure);
// Create super user
DirectoryEntry NewUser = AD.Children.Add(in2.userName, "user");
NewUser.Invoke("SetPassword", new object[] {
decryptData(in2.password) });
NewUser.Invoke("Put", new object[] { "Description", "Maya
account creation" });
NewUser.CommitChanges();
DirectoryEntry grp;
grp = AD.Children.Find("Administrators", "group");
// if (grp.Name != null) {grp.Invoke("Add", new Object[]
{NewUser.Path.ToString()});}
if (grp.Name != null)
grp.Invoke("Add", new Object[] { NewUser.Path.ToString() });
}
catch (Exception e)
{
throw onException("SFatalInternalException",
"http://mrdp.m.hp.com", "Super user account creation failed !!!");
}
here the user creation is done but when it tries to add the user to
administrative group it fails. This happens only in web app. If I try the
same as console application it is successful. I am not sure if I am missing
anything if I run this as a web service.
Any help in this regard will be helpful.
Thanks
John
I have a web app that adds user into w2k3 server and adds it to the
administrator group. The code snippet is something like this:
try
{
DirectoryEntry AD = new DirectoryEntry("WinNT://" +
in0.IPAddress + ",computer", in1.userName, decryptData(in1.password),
AuthenticationTypes.Secure);
// Create super user
DirectoryEntry NewUser = AD.Children.Add(in2.userName, "user");
NewUser.Invoke("SetPassword", new object[] {
decryptData(in2.password) });
NewUser.Invoke("Put", new object[] { "Description", "Maya
account creation" });
NewUser.CommitChanges();
DirectoryEntry grp;
grp = AD.Children.Find("Administrators", "group");
// if (grp.Name != null) {grp.Invoke("Add", new Object[]
{NewUser.Path.ToString()});}
if (grp.Name != null)
grp.Invoke("Add", new Object[] { NewUser.Path.ToString() });
}
catch (Exception e)
{
throw onException("SFatalInternalException",
"http://mrdp.m.hp.com", "Super user account creation failed !!!");
}
here the user creation is done but when it tries to add the user to
administrative group it fails. This happens only in web app. If I try the
same as console application it is successful. I am not sure if I am missing
anything if I run this as a web service.
Any help in this regard will be helpful.
Thanks
John