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

Forums / Developing with Sitefinity / Membership and Role provider works for authentication but not management in CMS

Membership and Role provider works for authentication but not management in CMS

10 posts, 0 answered
  1. Darren
    Darren avatar
    72 posts
    Registered:
    19 Mar 2008
    11 Nov 2009
    Link to this post
    I'm currently merging a Sitefinity based website with a YAF based forum with the request that authenication credentials should be shared between both sites.
    Since YAF has extended their membership table to include a lot of additional information I've gone the route of replacing the Telerik membership provider with a new membership provider which uses the YAF tables and sprocs. I'm also using the YAF role provider but since the original Sitefinity based website contains a lot of user profile information which we want to keep I've left the profile provider as the default provider.

    Now when I go to log into the Sitefinity based website it correctly uses the new providers and allows me to log in to the website.
    However, if I attempt to enter the CMS itself I just get the following error message.

    There is no data provider for class Telerik.Personalization.Data.PersonalizationValue. Did you forget to connect?


    So I re-added the standard Sitefinity membership provider along with my new provider and it now allows me to enter the CMS but if I go to manage users it just shows empty lists of users. So I've logged in and it's correctly authenticated me against the YAF based provider but managing users appears to be using the default provider and since the Membership table in Sitefinity no longer contains any users I just get empty lists. Equally, when I go to manage roles it also appears to be managing roles in the Sitefinity database even though the only role provider defined in the YAF provider.

    So presumably user and role management isn't using the definitions in web.config which I find strange since I've used my own providers in other sites with no problem. Could this because this particular site is using the free version of Sitefinity at the moment or do I need to make an additional change to get the CMS side to work with my own providers?

    Many thanks for any suggestions.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Nov 2009
    Link to this post
    Hello Darren,

    Can you paste the exact error message that you are getting. It seems that the problem comes from Nolics. Also it will be great if you can share the web.cofig file, so we could see if something is not set correctly.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Darren
    Darren avatar
    72 posts
    Registered:
    19 Mar 2008
    14 Nov 2009
    Link to this post
    When I log in and go to the administer users page of the CMS it lists no users in the main page but in the left hand list under "Users by role" it lists all the correct roles with the correct number of users next to each role.
    Click on a role to view the users in that role and you just get an error page. Now if I add matching roles back into the SItefinity database then I no longer get an error page but I do get an empty list of users so presumably the left hand menu is being driven by the defined providers in web.config but the main page is binding to the standard tables.

    Below are the providers defined in web.config.


    <roleManager enabled="true" defaultProvider="YafRoleProvider">
          <providers>
            <clear/>
            <add connectionStringName="yafnet" applicationName="YetAnotherForum" name="YafRoleProvider" type="YAF.Providers.Roles.YafRoleProvider"/>
          </providers>
        </roleManager>

        <membership defaultProvider="CustomProvider" hashAlgorithmType="SHA1">
          <providers>
            <clear/>
            <add connectionStringName="yafnet" applicationName="YetAnotherForum" name="CustomProvider" requiresUniqueEmail="false" minRequiredNonalphanumericCharacters="0" passwordStrengthRegularExpression="" useSalt="true" type="OPSC.YafMembershipProvider" />
            <add name="Sitefinity" connectionStringName="DefaultConnection" type="Telerik.DataAccess.AspnetProviders.TelerikMembershipProvider, Telerik.DataAccess" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" />
          </providers>
        </membership>

        <profile defaultProvider="Sitefinity">
          <providers>
            <clear />
            <add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess" />
          </providers>
          <properties>
            <add name="FirstName" />
            <add name="LastName" />
          </properties>
        </profile>

    Now the reason I have two membership providers defined is the first one (YAF) allows me to log into the website OK but if I try to access the admin pages I get an error message so I've re-added the original membership provider with the new provider so I can log into the admin pages. Remember that the Sitefinity database no longer includes any actual users but if I remove the provider completely then it won't allow me into the admin pages.

    Below are some of the errors I'm getting.

    If I click on the left hand menu item to view users within a role I get the following error.

    Role not found Registered

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Configuration.Provider.ProviderException: Role not found Registered

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ProviderException: Role not found Registered]
       Telerik.DataAccess.AspnetProviders.TelerikMembershipProvider.GetUsersInRole(String roleName, Int32 from, Int32 maxRows, String sortExpr, Int32& totalRows) +149
       Telerik.Security.UserManager.GetUsersInRole(String roleName, Int32 from, Int32 maxRows, String sortExpr, Int32& totalRows) +89
       Telerik.Security.WebControls.UsersDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +241
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
       System.Web.UI.WebControls.GridView.DataBind() +4
       Telerik.Security.WebControls.ManageUsers.BindUsers(Boolean dataChanged) +378
       Telerik.Security.WebControls.ManageUsers.BindUsers() +34
    


    Why is it using TelerikMembershipProvider? If I remove it from web.config completely then I can log in to the point of being authenticated and redirected but then I get the following error message. Now my membership provider is pretty standard but I guess I need to do more to the web.config file to get it to fully use the new provider or do I need to do something extra to get it to work with the profile provider in Sitefinity?

    There is no data provider for class Telerik.Personalization.Data.PersonalizationValue. Did you forget to connect?

    Server Error in '/' Application.

    There is no data provider for class Telerik.Personalization.Data.PersonalizationValue. Did you forget to connect?

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: Nolics.ORMapper.Base.NolnetException: There is no data provider for class Telerik.Personalization.Data.PersonalizationValue. Did you forget to connect?

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [NolnetException: There is no data provider for class Telerik.Personalization.Data.PersonalizationValue. Did you forget to connect?]
       Nolics.ORMapper.Base.QueryBase`1.GetProvider() +197
       Nolics.ORMapper.Base.QueryBase`1.LoadQuery(Int32 maxElements, Int32 fromElement) +275
       Nolics.ORMapper.Base.QueryBase`1.Load() +9
       Telerik.Personalization.Data.NolicsProvider.GetRow(String userName, String keyName, String moduleName) +92
       Telerik.Personalization.Data.NolicsProvider.Get(String userName, String keyName, String moduleName, T defaultValue) +47
       Telerik.Personalization.Data.NolicsProvider.GetModuleValue(String userName, String keyName, String moduleName, T defaultValue) +167
       Telerik.Personalization.Data.NolicsProvider.GetModuleValue(String keyName, String moduleName, T defaultValue) +73
       Telerik.Personalization.Data.NolicsProvider.GetModuleValue(String keyName, String moduleName) +62
       Telerik.Personalization.PersonalizationManager.GetModuleValue(String keyName, String moduleName) +64
       Telerik.Cms.Engine.ContentManager..ctor(String providerName) +86
       Telerik.Cms.Engine.ContentManager..ctor() +10
       Telerik.Events.EventsManager..ctor(String providerName) +22
       Telerik.Events.WebControls.EventsView.CreateChildControls() +116
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +44
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
    

    Many thanks for any ideas.

    Darren
  4. Darren
    Darren avatar
    72 posts
    Registered:
    19 Mar 2008
    14 Nov 2009
    Link to this post
    I now have a solution to this, thank you for looking into it.
    It seems that the table sf_Personalization had the wrong Application name for the administrator since the YAF site has its own application name. Once I updated this table to use the YAF application name everything appears to work for both YAF and Sitefinity.

  5. Darren
    Darren avatar
    72 posts
    Registered:
    19 Mar 2008
    17 Nov 2009
    Link to this post
    Sadly it wasn't as simple as I thought.
    It worked fine for a while then suddenly stopped.
    Strangely, I played around with the app name again, put it back to the original "/" and then changed YAF to the same and it started working again then stopped.

    YAF itself is working fine but theres just something strange going on around Personalization in Sitefinity. I'll post an update if I have any success.
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    19 Nov 2009
    Link to this post
    Hi Darren,

    I am not sure that we are aware of such issue. Just for confirmation - are you running Sitefinity 3.7SP1? Is it possible to send us the whole web.config file, via a private thread or an e-mail?

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Darren
    Darren avatar
    72 posts
    Registered:
    19 Mar 2008
    01 Jan 2010
    Link to this post
    This is still an issue which I've now returned to look at.

    When the website gets itself into this confused state I have to register a new user and then users can log back in with their accounts. I don't know why the action of registering a new user would fix the site but I've done the following to investigate the issue further.

    When the website stopped working I backed up the database and then registered a new user to get the website running correctly again.
    I then took a backup the database again and then diffed the two databases to look for any differences between the working and none working website.
    However, I can't see any differences other than the new account created so this is almost certainly not a database related issue.

    I can't see anything in IIS which could be causing this behaviour so this is likely something nolics specific but since I'm not familiar with nolics I'm not sure what.
    YAF continues to work fine with newly created accounts, this only affects the Sitefinity website.

  8. Darren
    Darren avatar
    72 posts
    Registered:
    19 Mar 2008
    03 Jan 2010
    Link to this post
    This is now working and boiled down to a missing change in web.config.
    While I'd created the new providers I hadn't updated the CMS security section to use the new custom providers. Making this change, adding the Sitefinity standard Membership provider back but using the custom membership provider as the default provider appears to have got everything working.

  9. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    04 Jan 2010
    Link to this post
    Hello Darren,

    I am glad that everything is working as expected. 

    In our next major release, configuration errors will be detected much more quicker. We now have a built in configuration editor which should help you to tweak the web.config in a easier way.

    Good luck during the new year.  

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. Terry Smith
    Terry Smith avatar
    3 posts
    Registered:
    28 Aug 2009
    21 Mar 2010
    Link to this post
    Hi Darren,

    Could you expand on what you found a bit? I'm also trying to integrate Sitefinity with another application's membership and role providers.

    When you say "While I'd created the new providers I hadn't updated the CMS security section to use the new custom providers.", what exactly do you mean by that?

    Also regarding "Making this change, adding the Sitefinity standard Membership provider back but using the custom membership provider as the default provider appears to have got everything working.", I don't understand how having two membership providers defined would work. Is it somehow using the default provider for authentication but then the Sitefinity provider for personalization?

    I would greatly appreciate any help you can offer.

    Thank you,
    Terry
Register for webinar
10 posts, 0 answered