Hi All,
I am running the following lines of code (C#) on a Windows XP platform:
DirectoryInfo folder = new DirectoryInfo(this.FullName);
DirectorySecurity dirSecurity = folder.GetAccessControl();
where this.FullName is the C:\ folder.
And I get the following exception:
Exception : The supplied handle is invalid. This can happen when trying to set an ACL on an anonymous kernel onject.
- My user id is VerusUser
- I can manually create folders in C:\ using this userid
- I cannot programmtically create folders in C:\ with this userid without getting the above exception
- I gave VerusUser Full Control to C:\ via the Properties\Advance\Permissions tab and I no longer received the exception i.e. everything worked fine.
- When I deleted VerusUser from the Properties\Advance\Permissions tab everything still worked fine i.e. I didn't receive an exception.
Can somebody explain:
- Why I'm receiving the exception and what is the best solution?
- Why I no longer receive the exception after I remove VerusUser from the Permissions tab?
Thanks,
Peter C