Click here to Skip to main content
15,895,841 members

Property value returned by DirectorySearcher and SearchResponse are of different type System._comobject and Byte array

Revision 2
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 by mayankkarki.
Tags: