 |
|
 |
this is not clear given,if they provide some sample example then it is ok
|
|
|
|
 |
|
 |
Hi,
I would like to know if a user of my domain can read a file...
I have done that but it work only with Windows 2003 server.
private static bool CanRead(string fname)
{
WindowsIdentity WinIdentity = new WindowsIdentity(@"MESGUEN_MAIN\Administrateur");
WindowsPrincipal WinPrincipal = new WindowsPrincipal(WinIdentity);
bool AllowRead = false;
FileInfo fi = new FileInfo(fname);
FileSecurity sec = fi.GetAccessControl();
foreach (FileSystemAccessRule rule in sec.GetAccessRules(true, true, typeof(NTAccount)))
{
if (WinPrincipal.IsInRole(rule.IdentityReference.Value))
{
if (((int)rule.FileSystemRights & (int)FileSystemRights.Read) > 0)
{
if (rule.AccessControlType == AccessControlType.Allow)
{
AllowRead = true;
}
else if (rule.AccessControlType == AccessControlType.Deny)
{
return false;
}
}
}
}
return AllowRead;
}
Could you help me?
luigi
|
|
|
|
 |
|
 |
This code works on my Windows XP test box, but when I install it on a Windows Server 2003 box, it fails.
The secuUtil.GetSecurityDescriptor() call always returns null.
The secuUtil.SetSecurityDescriptor() call throws the following exception: "The security ID structure is invalid. (Exception from HRESULT: 0x80070539).
|
|
|
|
 |
|
 |
Be aware: You can't just add new entry and hope that it works. You have to make sure that DACL is ordered properly.
|
|
|
|
 |
|
|
 |
|
 |
By the way, www.netomatrix.com has an exact copy of this article posted at:
http://www.netomatix.com/AddUserAceToFile.aspx
except of course that they don't give you any credit.
|
|
|
|
 |
|
 |
Oh, whatever. Now I see that Softomatrix is really Netomatrix and I'm wasting my time.
I was just annoyed seeing the same code twice when trying to solve my problem.
|
|
|
|
 |
|
 |
File Access Permissions can also be modified by using the Windows Scripting Host technology. See How to use Xcacls.vbs to modify NTFS permissions for more information.
Then, use a custom action in a Visual Studio .NET deployment project to invoke Xcacls.vbs to modify file access permissions.
|
|
|
|
 |
|
 |
I wrote a code like yours in my project, however I need to set the permissions to a whole tree of forders and files.
This task spend too much time... Do you know how to set the permissions into the root folder, and then it set the same permissions to its children?
Thanks,
Rodrigo Vilar
|
|
|
|
 |
|
 |
Hi,
how to search AD and cancel the searching process using IDirectorySearch ?I know that IDirectorySearch has the ExecuteSearch and AbandonSearch method,but I need to using c# to do this.In c#,how to using IDirectorySearch interface?
If you know,please give me some sample code.
Thanks,
Eckel
|
|
|
|
 |
|
 |
Hello,
I am having a problem with using ActiveDS.dll. I am developing an application that requires me to check permissions on particular objects in an LDAP system. When building this application I do not receive any errors. However, when I run this application under Administrator (logged in user account has no bearing on this issue as it happens on other accounts too) in Windows 2003 Server, I get "Active Directory Client is not installed on this computer." I have tried adding the interop from the listed COM assemblies in IDE and also using TLBMP to create and strong name the interop but to no avail. Someone suggested to add this interop to the GAC but that didn't affect it any.
If it matters any, I am developing on a Win 2k machine without AD nor LDAP functioning. I simply build, transfer, and test.
Any help is appreciated, Thanks.
KT
|
|
|
|
 |
|
 |
I'm having the same problem , if you have resolved this problem please send me an e-mail at juamomos@hotmail.com
|
|
|
|
 |
|
 |
Hello,
I am having a problem with using ActiveDS.dll. I am developing an application that requires me to check permissions on particular objects in an LDAP system. When building this application I do not receive any errors. However, when I run this application under Administrator (logged in user account has no bearing on this issue as it happens on other accounts too) in Windows 2003 Server, I get "Active Directory Client is not installed on this computer." I have tried adding the interop from the listed COM assemblies in IDE and also using TLBMP to create and strong name the interop but to no avail. Someone suggested to add this interop to the GAC but that didn't affect it any.
If it matters any, I am developing on a Win 2k machine without AD nor LDAP functioning. I simply build, transfer, and test.
Any help is appreciated, Thanks.
KT
|
|
|
|
 |
|
|
 |
|
 |
I am trying to use the ADsSecurityUtilityClass but it doesn't seem to exist in the ActiveDs (it gets underlined as "could not be found"). I referenced the Active DS Type Library (activeds.tlb) and placed it in my uses area (as explained in the article). I even tried searching through the available methods but it didn't seem to show up anywhere (I did this by typing "ActiveDs." and searching through available methods).
I'm running MS Visual Studio .NET 2002 PRO on Windows 2000 Advanced Server
Am I missing something or if possible is there another way to use the ADsSecurityUtilityClass?
Any input would be greatly appreciated . I have been stuck on this problem for days.
Thanks.
Jorj.
|
|
|
|
 |
|
 |
ADsSecurityUtilityClass is not supported on WIndows 2000 and earlier. It is only available on XP and Windows 2003.
---
Softomatix
http://www.netomatix.com
|
|
|
|
 |
|
 |
If ADsSecurityUtilityClass is not supported by Windows 2000 then what alternative could I use for Adding File Access Permissions?
Thanks again for any assistance.
Jorj.
|
|
|
|
 |
|
 |
Softomatix wrote:
ADsSecurityUtilityClass is not supported on WIndows 2000 and earlier. It is only available on XP and Windows 2003.
Isn't it possible to add it? Like copying the ActiveX library to the system?
Thanks
Freek Versteijn
|
|
|
|
 |
|
 |
You can use Win32Security.dll from Microsoft for access and manipulate file security e.t.
|
|
|
|
 |
|
 |
yeah...
even i couldnot find that class...
|
|
|
|
 |
|
 |
It would be super cool if you spent an additional 10 minutes and modified your code so that it was a little more general rather than being a specific example of giving "ASPNET" access to a hard coded log file.
Regardless, thanks for the "how to".
-Kevin Buchan
|
|
|
|
 |
|
 |
We are just little lazy around here We are just trying to keep the posted code as simple as we can.
---
Softomatix
http://www.pardesifashions.com/Softomatix/default.aspx
|
|
|
|
 |
|
 |
LOL. I can speak "Lazy". Heck, being lazy is the whole reason I got into programming. No sense doing a repetitive task more than once!
Cheers.
-Kevin Buchan
|
|
|
|
 |