2010-08-31 50 views
0

我想知道怎样才能得到用户名和他的密码,并使用它时,我CRM IFD用户名和密码

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); 

感谢设置crmservice连接助手:)

回答

2

我假设你在谈论IFD登录页面?您无法从该页面提取用户的凭据。如果您需要用户的凭据,则需要将其放入自定义页面。

您也可以使用完成,这将使用当前用户的凭据UseDefaultCredentials属性orgrequest:

CrmDiscoveryService disco = new CrmDiscoveryService(); 
disco.Url = "https://localhost/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx"; 
disco.UseDefaultCredentials = true; 

或者,如果你这样做是一个自定义的页面上,你可以使用一个HttpContext/HttpRequest auth

+0

tnx为答案我会这样做 – Lior 2010-09-02 09:03:15