我可以禁用MS CRM 2011 SDK中的登录提示,如果凭据是错了吗? [英] Can I disable the login prompt for MS CRM 2011 SDK if credentials are wrong?
本文介绍了我可以禁用MS CRM 2011 SDK中的登录提示,如果凭据是错了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在,我访问的 CRM SDK 如下:
IServiceManagement<IDiscoveryService> serviceManagement =
ServiceConfigurationFactory.CreateManagement<IDiscoveryService>(discoveryUri);
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential(userName, password, domain);
using (DiscoveryServiceProxy serviceProxy = new DiscoveryServiceProxy(new DiscoveryServiceProxy(serviceManagement, credentials))
{
RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
RetrieveOrganizationsResponse orgResponse =
(RetrieveOrganizationsResponse)service.Execute(orgRequest);
// do something with organisations
}
然而,如果域凭据是不正确的,一个的Windows 强出现>登录提示符(在某处 service.Execute
)。我不想说登录提示。我已经解决此问题,通过使用 PrincipalContext
验证凭据它们传递给 DiscoveryServiceProxy
工作过,但我'M与不完全满意。
However, if the domain credentials are incorrect, a Windows login prompt appears (somewhere in service.Execute
). I don't want that login prompt. I have worked around this issue by validating the credentials using PrincipalContext
before passing them to the DiscoveryServiceProxy
, but I'm not entirely happy with that.
有没有一种方法来禁用登录提示?
Is there a way to disable the login prompt?
推荐答案
上的 CRM论坛告诉我该怎么做:
credentials.ClientCredentials.SupportInteractive = FALSE;
这篇关于我可以禁用MS CRM 2011 SDK中的登录提示,如果凭据是错了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文