“无法将System.Byte []的对象强制转换为ActiveDs.IADsSecurityDescriptor" [英] "Unable to cast object of System.Byte[] to ActiveDs.IADsSecurityDescriptor"

查看:94
本文介绍了“无法将System.Byte []的对象强制转换为ActiveDs.IADsSecurityDescriptor"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我正在使用 LDAPconnection 类并通过SSL连接.我设法获得nTSecurityDescriptor值,但现在出现错误

My problem is that I am using LDAPconnection class and connecting over SSL. I manage to get nTSecurityDescriptor value but now getting error

无法将System.Byte []的对象强制转换为ActiveDs.IADsSecurityDescriptor"

"Unable to cast object of System.Byte[] to ActiveDs.IADsSecurityDescriptor"

我正在使用这样的代码

SearchResponse response = (SearchResponse)connection.SendRequest(request);
IADsSecurityDescriptor sd = (IADsSecurityDescriptor)response.Entries[0].Attributes["nTSecurityDescriptor"][0];

有任何错误或其他方法可以做到这一点吗?

Is there any error or some other way to do this?

推荐答案

最后,我找到了问题的答案.此类将byte []转换为有效的安全解密器comobject.

At last I find the answer of my question. This class convert the byte[] to valid security decriptor comobject.

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);

这篇关于“无法将System.Byte []的对象强制转换为ActiveDs.IADsSecurityDescriptor"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆