简体   繁体   English

根据C#中的交换通讯组列表或AD组验证登录的用户

[英]Verify logged in user against exchange distribution list or AD groups in c#

I am trying to verify whether the logged in user exists in a AD group or distribution list. 我正在尝试验证登录的用户是否存在于AD组或通讯组列表中。 I tried to use WindowsIdentity but that does not give me proper results. 我尝试使用WindowsIdentity,但这不能给我适当的结果。 If I add a user to the DL and then check whether the user is in the DL, it gives me incorrect results. 如果我将用户添加到DL中,然后检查该用户是否在DL中,则会给我不正确的结果。

I restarted my IIS and even cleared my browser cookies and cache, but no luck. 我重新启动了IIS,甚至清除了浏览器的cookie和缓存,但没有运气。 Where does the IsInRole() function verifies for the user role. IsInRole()函数在哪里验证用户角色。 In AD or on local machine....? 在AD还是在本地计算机上...? I tried to remove myself from local machine group too, but it still authorizes me for that group. 我也尝试将自己从本地计算机组中删除,但是它仍然授权我加入该本地计算机组。 Any help would be appreciated. 任何帮助,将不胜感激。

If you are using .NET 3.5, you can consider to use Principal.IsMemberOf() in System.DirectoryServices.AccountManagement. 如果使用的是.NET 3.5,则可以考虑在System.DirectoryServices.AccountManagement中使用Principal.IsMemberOf()。 I tried it and it works with AD security group as well as DL. 我尝试了它,它可以与AD安全组以及DL一起使用。 More details about how to programming with groups can be found here 有关如何使用组进行编程的更多详细信息,请参见此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM