In order to use the CRM Membership Provider, you must first import the Managed CRM Solution “Webintegration” into your CRM System. Read more on the CRM Solution page.

Authorization in ASP.NET Based CMS Systems

If your CRM System supports ASP.NET Memberships and Forms Authentication, you can use the CRM Membership provider. Please refer to the documentation of your CMS System, on how to implement the provider.

Authorization in ASP.NET based websites

The Source code contains a sample MVC 3 based website with all the configuration in place. Download and run the website to see the CRM Membership Provider in action. In order to Authorize an Action on a MVC based website, just insert the [Authorize()] Attribute above the Controller Method. The Example below tells the Website, that only authorized users can use the “About” Action, and only those who have the “Member” Role:

 public ActionResult About()
    return View();

Activating the Membership and Role Provider in your ASP.NET Website

All configuration is done in the Web.config file of the website.

Step 1: Add a connection string that points to the CRM Server

Add a new entry in the <connectionStrings> section. Example:

  <add name="CrmServices" connectionString="Url=; Username=RoleUser; Password=p@ssw0rd; Domain=APPLICATION" providerName="Applications.Framework.Web.Providers.CrmMembershipProvider"/>

The Connection String is made up of the following parts:

  • URL: Is the URL pointing to your Organization.svc file on your CRM website
  • Username, Password, Domain: The User name/Password and Domain name of a valid CRM User with Read/Write access to Contact, Web Membership and Web Role.


Step 2: Add the Membership Provider

Set the default provider to the Crm Membership Provider and add a new entry in the <membership> section to configure the provider:

<membership defaultProvider="CrmMembershipProvider">
    <add name="CrmMembershipProvider" type="Applications.Framework.Web.Providers.CrmMembershipProvider" connectionStringName="CrmServices" applicationName="MyApp"
         entityName="appl_webmembership" userNameField="appl_name" emailField="emailaddress" passwordField="appl_password" passwordQuestionField="appl_passwordquestion" passwordAnswerField="appl_passwordanswer"
         lastLoginDateField="appl_lastlogindate" lastActivityDateField="appl_lastactivitydate" lastPasswordChangeDateField="appl_lastpasswordchangedate" lastLockoutDateField="appl_lastlockoutdate" isLockedoutField="appl_islockedout" isApprovedField="appl_isapproved" relatedContactField="appl_contactid" applicationNameField="appl_applicationname"
         enablePasswordReset="true" enablePasswordRetrieval="true" maxInvalidPasswordAttempts="3" minRequiredNonAlphanumericCharacters="0" minRequiredPasswordLength="6" passwordAttemptWindow="10" requiresQuestionAndAnswer="false" requiresUniqueEmail="true"


Step 3: Add the Role Provider

Set the default Role Manager to the Crm Role Provider and add a new entry in the <rolemanager> section to configure the provider:

<roleManager enabled="true" defaultProvider="CrmRoleProvider">
    <add name="CrmRoleProvider" type="Applications.Framework.Web.Providers.CrmRoleProvider" connectionStringName="CrmServices" applicationName="MyApp"
         entityName="appl_webrole" roleNameField="appl_name" applicationNameField="appl_applicationname"
         userEntity ="appl_webmembership" userNameField="appl_name" userRelationshipName="appl_webmembership_appl_webrole" />

Last edited Nov 7, 2012 at 12:28 AM by Applications, version 2


No comments yet.