我想知道在设置crmservice连接时如何获取用户名和密码并使用它们
CrmDiscoveryService disco = new CrmDiscoveryService();
disco.Url = "https://localhost/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";
//Retrieve a list of available organizations from the CrmDiscoveryService Web service.
RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
HERE I WANT TO PUT THE USERNAME AND PASSWORD FROM THE SIGNIN PAGE
// Substitute an appropriate domain, username, and password here.
orgRequest.UserId = domain + "\\" + username;
orgRequest.Password = password;
RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)disco.Execute(orgRequest);感谢帮手:)
发布于 2010-08-31 23:52:21
我猜你说的是IFD签到页面?您无法从该页面中提取用户的凭据。如果您需要用户的凭据,则需要将其放入自定义页面中。
您还可以使用UseDefaultCredentials属性来完成orgrequest,该属性将使用当前用户的凭据:
CrmDiscoveryService disco = new CrmDiscoveryService();
disco.Url = "https://localhost/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";
disco.UseDefaultCredentials = true;或者,如果您在自定义页面上执行此操作,则可以使用HttpContext/HttpRequest auth。
https://stackoverflow.com/questions/3608426
复制相似问题