Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: LDAP
Hi,
I am working on a website to manage active directory. I want to check that whether user has permission to change password or not.
So I have to find "ntSecurityDescriptor" property value after that I have to cast it into IADsSecurityDescriptor.
Now if I use DirectorySearcher class then property value is of type System._ComObject and easily casted to IADsSecurityDescriptor.
But when I use LdapConnection and SearchResponse I get property value of type byte[] array which is unale to cast to IADsSecityDescriptor. I am getting error
"Unable to cast System.Byte[] to IADsSecurityDescriptor".
 
Is there some problem with SearchResponse or I have use some kind of casting technique to achieve this.
I have some problem to use DirectoryEntry class so I can only use LdapConnction class.
 
Please help its urgent.
Thanks.
Posted 17-Nov-12 19:16pm
Edited 18-Nov-12 21:47pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

At last I find the answer of my question. This class convert the byte[] to valid security descriptor com object.
ActiveDs.ADsSecurityUtility secUtility = new ActiveDs.ADsSecurityUtility();
ActiveDs.IADsSecurityDescriptor sd = (IADsSecurityDescriptor)secUtility.ConvertSecurityDescriptor((byte[])attribute[0], (int)ADS_SD_FORMAT_ENUM.ADS_SD_FORMAT_RAW, (int)ADS_SD_FORMAT_ENUM.ADS_SD_FORMAT_IID);
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Nirav Prabtani 298
1 CPallini 209
2 Mika Wendelius 185
3 OriginalGriff 182
4 Sergey Alexandrovich Kryukov 176
0 Nirav Prabtani 398
1 OriginalGriff 292
2 Sergey Alexandrovich Kryukov 251
3 Mika Wendelius 185
4 Abhinav S 180


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 24 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100