Custom Membership- & RoleProvider

Posted by Community Admin on 04-Aug-2018 12:39

Custom Membership- & RoleProvider

All Replies

Posted by Community Admin on 30-Oct-2014 00:00

Hello,

We're trying to integrate our CRM system with a new Sitefinity Portal. We would like to be able to use the Custom Membership & Roleprovider in Sitefinity we've written in our CRM system.

 For this scenario, I've studied this page: www.sitefinity.com/.../choosing-the-provider-options

We would like to implement the case 2 scenario. I've successfully connected the membership provider. I can login using our membership provider. 

We would like to be able to use our roles and grant access to specific pages to these roles using our custom Role Provider. Therefor, I've enabled the RoleManager in the web.config and added our roleprovider:

<roleManager enabled="true">
  <providers>
    <add name="GfhRoleProvider" type="Gfh.Membership.GfhRoleProvider, Gfh.Membership" />
  </providers>
</roleManager>

This isn't working yet. When I try to open the admin users or roles pages, Sitefinity gives the following error:
An attempt to attach an auto-named database for file ~\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Any suggestions? See attachment for a complete stack trace.

Kind regards,
Mark

 

 

Posted by Community Admin on 30-Oct-2014 00:00

Hi Mark,

It looks like a database connection issue. It seems that the RoleProvider isn't aware of the fact it uses a different database. Maybe you can post the code of the RoleProvider? Or sent it by mail ;)

Do you inherit the specific Sitefinity RoleDataProvider class, or the one from ASP.NET itself?

Best,
Daniel

Posted by Community Admin on 30-Oct-2014 00:00

Hi,

The RoleProvider is just a mockup for now, but I would like to inherit from the System.Web.Security.RoleProvider, for reusability reasons.

 It's not my Custom RoleProvider where the error comes from, see the stack trace. The error is generated by  System.Web.Security.SqlRoleProvider.GetAllRoles()

Kind Regards,
    Mark 

Posted by Community Admin on 21-Nov-2014 00:00

Found the solution, with some help from Telerik support: I missed the defaultProvider attribute in the Rolemanager element in the web.config:

<roleManager enabled="true" defaultProvider="GfhRoleProvider">

 That did the trick.

This thread is closed