Search code examples
asp.netasp.net-membershipasp.net-roles

How to use user.context object for CRM Users in ASP.NET MVC


I'm consuming a WCF Webservice with CRM Backend. All the users are stored in CRM. User can have different roles e.g. Supervisor, Team Leader etc.

I would like to use the asp.net User.Identity.Name or User.IsInRole etc. Could someone please advise how this can be achieved?


Solution

  • You'll need to use a Membership/Role provider that can query the CRM backend. There is an old implementation against CRM 2011 on CodePlex, that might work for you:

    If that doesn't work, you'll have to create one yourself, the API is pretty straight forward, there are a number of existing questions here on StackOverflow that explain the process of creating and configuring a custom membership provider. See: