+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Membership- & RoleProvider

Custom Membership- & RoleProvider

4 posts, 0 answered
  1. Mark
    Mark avatar
    9 posts
    Registered:
    11 Nov 2010
    30 Oct 2014
    Link to this post

    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: http://www.sitefinity.com/documentation/documentationarticles/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

     

     

  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    30 Oct 2014
    Link to this post

    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

  3. Mark
    Mark avatar
    9 posts
    Registered:
    11 Nov 2010
    30 Oct 2014 in reply to Daniel Plomp
    Link to this post

    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 

  4. Mark
    Mark avatar
    9 posts
    Registered:
    11 Nov 2010
    21 Nov 2014
    Link to this post

    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.

4 posts, 0 answered