You will need add References to the Microsoft.Xrm.Sdk and Microsoft.Xrm.Tooling.Connector to your application, and have logic for connecting to your CRM environment. Within your asp.net application you have a couple of options to connect:
// add the following in the Using section:
using Microsoft.Xrm.Tooling.Connector;
private IOrganizationService service;
// Connect Using Connection String
CrmServiceClient conn = new CrmServiceClient(connectionString);
// Connect Using Credentials
NetworkCredential creds = new NetworkCredential(userName, ConvertToSecureString(CRM_PASSWORD));
AuthenticationType authType = AuthenticationType.Office365;
CrmServiceClient conn = new CrmServiceClient(userName, ConvertToSecureString(CRM_PASSWORD), "NorthAmerica", orgName, isOffice365: true);
// After creating the connection, you will need to map it to the Organization Service:
service = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;
// You can use the following function to ConvertToSecureString
private static System.Security.SecureString ConvertToSecureString(string password)
{
if (password == null)
throw new ArgumentNullException("missing pwd");
var securePassword = new System.Security.SecureString();
foreach (char c in password)
securePassword.AppendChar(c);
securePassword.MakeReadOnly();
return securePassword;
}
Once you have the connection you can manipulate the CRM entities to create/retrieve information.
Hope this helps.