Verify logged in user against exchange distribution list or AD groups in c#
I am trying to ver开发者_运维知识库ify whether the logged in user exists in a AD group or distribution list. I tried to use WindowsIdentity but that does not give me proper results. If I add a user to the DL and then check whether the user is in the DL, it gives me incorrect results.
I restarted my IIS and even cleared my browser cookies and cache, but no luck. Where does the IsInRole() function verifies for the user role. In AD or on local machine....? 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. I tried it and it works with AD security group as well as DL. More details about how to programming with groups can be found here
精彩评论