问题
Right now I access the CRM SDK as follows
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
}
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?
回答1:
Someone on the CRM forums told me what to do:
credentials.ClientCredentials.SupportInteractive = false;
来源:https://stackoverflow.com/questions/14646645/can-i-disable-the-login-prompt-for-ms-crm-2011-sdk-if-credentials-are-wrong