UserPrincipal.GetGroups与UserPrincipal.GetAuthorizationGroups? [英] UserPrincipal.GetGroups vs. UserPrincipal.GetAuthorizationGroups?

查看:669
本文介绍了UserPrincipal.GetGroups与UserPrincipal.GetAuthorizationGroups?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.Net MVC 4.0来查询Active Directory。我想获得一个用户的组成员名单和遍历它们。我有一个奇怪的问题。为了得到我所用的组:

I am using ASP.Net 4.0 MVC to query active directory. I am trying to get a list of a user's group memberships and that iterate through them. I am having a weird problem. To get the groups I was using:

   PrincipalSearchResult<Principal> groups = up.GetGroups();

,当移动到IIS6在本​​地主机上的工作很好,但返回一个空集。所以,我尝试使用这样的:

Which worked great on localhost but returns an empty set when moved to IIS6. So I tried using this:

    PrincipalSearchResult<Principal> groups = up.GetAuthorizationGroups();

这在IIS6伟大的工作,但返回本地主机上的空集。这两个方法之间的区别是什么?为什么我可以使用一个在IIS6,而不是在本地主机?为什么我可以用另外一个在本地主机上,而不是在IIS6?

Which worked great on IIS6 but returns an empty set on localhost. What is the difference between these 2 methods? Why can I use one in IIS6 and not on localhost? Why can I use the other one on localhost and not in IIS6?

推荐答案

我假设 GetAuthorizationGroups()调用到tokenGroups公元。为了阅读,您的服务帐户(或IIS机器的帐户,如果网络服务)需要Windows授权访问组在公元研究。

I assume GetAuthorizationGroups() calls in to tokenGroups in AD. To read that, your service account (or IIS machine account if Network Service) needs to be in the Windows Authorization Access group in AD.

这篇关于UserPrincipal.GetGroups与UserPrincipal.GetAuthorizationGroups?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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