I am trying to implement custom membership and role provider for the pages created in sitefinity. I have created the custom membership provider inheriting ASP.NET Membership provider, but i could not see the users from my database under Administrator/Users, when I select the custom provider.
And when I create role provider, the sitefinity user is getting authorized by my role provider. I could not see the roles from my database under Administrator/Roles.
My requirement is I want to authenticate the user from my own provider and provide access to the sitefinity pages based on my own role provider. I could achieve the authentication part, but could not provide permissions based on roles from my provider.
Could you please provide me some source, so that I can implement Custom membership and role provider in my application.
The changes I did in web.config:
<membership defaultProvider="Default" >
<add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity"/>
<add name="CustomMembershipProvider" type="AssociatePortal.CustomMembershipProvider" connectionStringName="DealerPortalDB" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="AssociatePortal/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
<roleManager enabled="true" defaultProvider="CustomRoleProvider">
<add connectionStringName="DealerPortalDB" name="CustomRoleProvider" type="AssociatePortal.CustomRoleProvider"/>
We have a full code sample for implementing the CustomMembershipProvider here. Following the documentation tutorial should lead to a working membership provider, you could check the registration of the provider.
In order to achieve compatibility with the ASP.NET Membership and Role providers, we have implemented wrappers for both. What this means is that you can actually develop your custom Role or Membership provider using entirely .NET Framework standards and API, and register it in your Sitefinity project as you would do in any other Asp.Net WebApplication. More information about the RoleProvider could be found here.
You should implement a set of rules for the Role Provider, similarly to the Membership Provider and add the logic for the roles data there.
/// Gets the provider abilities for the current principal. E.g. which operations are supported and allowed
/// <value>The provider abilities.</value>
ProviderAbilities abilities =
I have implemented the custom membership provider. Its working fine. I am trying to implement RoleDataProvider now. I am unable to get an idea of how to implement CreateUserLinks() method for assigning roles to users and insert a record in my database. Can you please provide the code for that.
And I could not found any method like AssignUserToRole as in ProviderAbilities.
Thanks & Regards,
List<UserLink> listEntities =
(var entity =
var rolesQuery = from ul
where ul.app_name ==
ApplicationName = ul.app_name,
Id = ul.id,
LastModified = (DateTime)ul.last_modified,
Id = entity.sf_roles.Where(r=> r.id == ul.role_id).FirstOrDefault().id,
Name = entity.sf_roles.Where(r=> r.id == ul.role_id).FirstOrDefault().nme,
ApplicationName = entity.sf_roles.Where(r => r.id == ul.role_id).FirstOrDefault().app_name
MembershipManagerInfo = UserManagerInfo,
UserId = (Guid)ul.user_id
listEntities = rolesQuery.ToList();
Can you tell me how to provide access to the sitefinity backened to edit the pages using custom roles. I have tried many options which are provided in forums but nothing is working in my case.
I have a user which has a custom role. Now I need to provide some permissions to this custom role so that the user can access pages tab with the pages permitted to edit in sitefinity.