With CRM 4.0 and IFD getting popular by the day. We have had to work on the Login function for CRM to support IFD install. In case of IFD the authentication type is changed to Forms Authentication where you are presented with a Sign-in page for login.
Further to our post on Login for various CRM deployments here is the code for IFD that has been added to the list.
The code below should help users developing application that need to work from an IFD environment.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// login to crm with Default Credential for IFD
//set orgname and url to properties
strOrg = strOrgName;
strserverurl = strCRMURL; // It must have on- premise url for example http://moss:5555
//init CrmImpersonator object
_impersonator = new CrmImpersonator();
//Initialize CrmAuthenticationToken token
token = CrmAuthenticationToken.ExtractCrmAuthenticationToken(context, strOrgName);
token.OrganizationName = strOrgName;
token.AuthenticationType = 0;
//initialize the Service
service = new CrmService();
//pass DefaultCredentials
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
//pass CrmAuthenticationTokenValue
service.CrmAuthenticationTokenValue = token;
service.Url = strCRMURL + "/mscrmservices/2007/crmservice.asmx";
No comments:
Post a Comment