I have web application which creates user on the same server where
application is running.
It works on my local but when i deploy, it says general errror
System.UnauthorizedAccessException: General access denied error
at System.DirectoryServices.Interop.IAds.SetInfo()
at System.DirectoryServices.DirectoryEntry.CommitChanges()
I have given admin rights to ASP.NET user and the one who connected to
the appliction also has Admin Rights to the system. What else i am
missing on the security level?
<identity impersonate="false" /> in my config.
Can some one help me..
Thanks in advance
Malar
Below is the code for creating an user
DirectoryEntry objAD;
DirectoryEntry objNewUser;
DirectoryEntry objGrp;
string strConn;
//active directory connection string
strConn = "WinNT://"+ Environment.MachineName + "," + "computer";
//active directory entry point for above connection string
objAD = new DirectoryEntry(strConn);
//new user is added
objNewUser = objAD.Children.Add(sUserName, "user");
objNewUser.Invoke("SetPassword", new object[] {sPassword});
objNewUser.Invoke("Put", new object[] {"Description", sfullName});
objNewUser.CommitChanges();
//finding group
objGrp = objAD.Children.Find("Users", "group");
//adding new user to group
if (objGrp.Name != "")
{
objGrp.Invoke("Add", new object[] {objNewUser.Path.ToString()});
}//endif
sRetVal="true";
The app pool runs as network service by default, so you might need to give
it permissions to do what you want or consider setting up IIS to run as a
privileged account.
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
<tmj...@gmail.com> wrote in message
news:036311e4-e82e-4429...@m3g2000hsc.googlegroups.com...