使用soap web api的MS Dynamics CRM身份验证
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = "********";
credentials.UserName.Password = "********";
Uri serviceUri = new Uri("https://********.api.crm.dynamics.com/XRMServices/2011/Organization.svc");
credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
Uri HomeRealm = null;
OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, HomeRealm, credentials, null);
{
_service = (IOrganizationService)proxy;
//fields mapping with Dynamics crm entity fields
//pushing the data to Dynamics crm using aspx page
Entity contact = new Entity("contact");
contact["firstname"] = txtFirstName.Text.ToString();
Guid newContactId = _service.Create(contact);
txtFirstName.Text = "";
}