2010-08-31 52 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