获取组名时出错。指定的域不存在或无法联系。 [英] Error obtaining group names. The specified domain either does not exist or could not be contacted.

查看:329
本文介绍了获取组名时出错。指定的域不存在或无法联系。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从以下网站获取此代码:

I obtained this code from:

https://support.microsoft.com/en-us/help/316748/how-to-authenticate-against-the -active-directory-by-using-forms-authen

https://support.microsoft.com/en-us/help/316748/how-to-authenticate-against-the-active-directory-by-using-forms-authen

使用我的经过验证的路径复制并粘贴所有内容并更改LDAP路径,我仍然收到有关查找组名称和域不存在的错误。我搜索了互联网并查找除正确答案之外的所有内容。 

Copy and pasted everything and changed LDAP path with my verified path and I still get this error about finding group names and domain does not exists. I searched the internet and find everything except the correct answer. 

从Visual Studio Enterprise 2017编译Windows 10 Pro。

Windows 10 Pro compiling from Visual Studio Enterprise 2017.

当我出错时会出现错误结果输入有效的域名,用户名和密码后选择登录按钮。 

Error results when I select logon button after I enter valid domain, username and password. 

有任何帮助吗? 

Any help out there? 

谢谢

***更新 - 感谢您提供可能的解决方案。我已经详尽地尝试了所有的东西,甚至读到这不是为了工作。在这甚至开始考虑工作之前必须满足数以千计的条件,就像它必须是本月第3个星期四的
并且在西北吹风的时候在外面下雨,只有你的名字是史蒂夫和你拥有一只名叫马文的狗,他懂得量子弦理论。然后就在那时它可能会工作,即使所有代码都完美无缺。我有
取消了这个项目。再次感谢

***UPDATE - Thank you for the possible solutions. I have exhaustively tried pretty much everything even reading that this is not designed to work. Thousands of conditions must be met before this will even begin to consider to work, like it has to be the 3rd Thursday of the month and be raining outside with the wind blowing North by Northwest and only if you name is Steve and you own a dog named Marvin who understands quantum string theory. Then just then it may work even though all code it flawless. I have scrapped this project. Thanks again

推荐答案

您是否正在尝试对任意用户进行身份验证或当前正在使用您的应用的用户?如果您正在使用当前的应用程序用户,那么您不需要任何该代码。您只需使用当前的

本金
。请注意,我不记得这是否会获得所有嵌套组或直接成员。 

Are you trying to authenticate an arbitrary user or the user currently using your app? If you're using the current app user then you don't need any of that code. You can simply use the current principal. Note that I don't remember if this gets all the nested groups or just direct members. 

为了确保您获得所有组(或者除了当前用户之外的用户) d想要使用

GetAuthorizationGroups
。要获取UserPrincipal,您可以使用
构造函数
它接受上下文和UN / PWD。
context
将是你的域名信息。上下文只需要类型(ContextType.Domain)和域名。

To ensure you get all groups (or for users other than the current user) you'd want to use GetAuthorizationGroups instead. To get the UserPrincipal you can use the constructor which accepts the context and UN/PWD. The context will be your domain info. The context just requires the type (ContextType.Domain) and domain name.


这篇关于获取组名时出错。指定的域不存在或无法联系。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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