Last post Jun 06, 2013 03:47 AM by mayankkarki
Nov 19, 2012 01:57 AM|mayankkarki|LINK
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.
Nov 25, 2012 08:58 PM|Angie xu - MSFT|LINK
I notice that you have post the same thread in .NET Framework Forums, glad that you've solved your problem by yourself.
if someone is interested in this problem, please refer the solution
Jun 06, 2013 03:47 AM|mayankkarki|LINK
ActiveDs.ADsSecurityUtility secUtility = new ActiveDs.ADsSecurityUtility(); ActiveDs.IADsSecurityDescriptor sd = (IADsSecurityDescriptor)secUtility.ConvertSecurityDescriptor((byte)attribute, (int)ADS_SD_FORMAT_ENUM.ADS_SD_FORMAT_RAW, (int)ADS_SD_FORMAT_ENUM.ADS_SD_FORMAT_IID);