How to tell if the current user is an IIS Manager or a Server Administrator?
We have installers that fail at the end of an Add/Remove because the user doesn't have sufficient prividgles to create or delete virtual directories.
Before getting into the meat and potatoes of the install/uninstall operation, is there anyway to check can the user create or delete cirtual directories.
Is there a Permissions Directory we can look up and check for the current user, or something similar?
Thanks
BW
I found this on Code Project, and it does what I need.
The crux of it is the System.IO.FileInfo.GetAccessControl().GetAccessRules
method to get the ACL for the folder.
Snippet
System.IO.FileInfo fi = new System.IO.FileInfo(_path);
AuthorizationRuleCollection acl = fi.GetAccessControl().GetAccessRules(true, true, typeof(SecurityIdentifier));
for (int i = 0; i < acl.Count; i++) {
System.Security.AccessControl.FileSystemAccessRule rule = (System.Security.AccessControl.FileSystemAccessRule)acl[i];
if (_principal.User.Equals(rule.IdentityReference)) {
if (System.Security.AccessControl.AccessControlType.Deny.Equals. (rule.AccessControlType)) {
if (contains(FileSystemRights.AppendData,rule))
_denyAppendData = true;