Re: SetOwner problem?




I am also need to do similar thing in .Net 2.0. I have a directory which
has got full access to system account. If i see the advanced tab in
security dialog of that directory it shows system full access. In the
owner tab it shows the current owner and In change owner list box it
shows administrators group. Now i have created a new user and made him
a member of admin group. Now i am running the code in the newly created
owner account and i want to set the owner ship to this new user, who is
part of admin group. But the call
dInfo.GetAccessControl(AccessControlSections.Owner); fails saying
unauthorized access. From explorer i am thinking admin group can take
the ownership but i am not able to change the owner with a user who is
part of admin group. Please help me on this as soon as possible.


Brian Kirkegaard wrote:
*I'm having a problem using DirectorySecurity.SetOwner int DotNet.
I'm using
the following very simple code:

DirectoryInfo dInfo = new DirectoryInfo(strFolder);
DirectorySecurity oDirectorySecurity =
dInfo.GetAccessControl(AccessControlSections.Owner);
oDirectorySecurity.SetOwner(new NTAccount(strUser));
dInfo.SetAccessControl(oDirectorySecurity);

But th SetAccessControl throws an System.InvalidOperationException
with the
following message:
"The security identifier is not allowed to be the owner of this
object.".

Any idea what the problem is and hopefully a solution?

Thanks,
-Brian *



--
kotapati
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1818141.html

.



Relevant Pages