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

Forums / General Discussions / Mulitple Membership Providers

Mulitple Membership Providers

13 posts, 0 answered
  1. Jerami
    Jerami avatar
    12 posts
    Registered:
    31 Mar 2011
    28 Apr 2011
    Link to this post
    Getting frustrated here...not sure what Im doing wrong.

    Ok so we have the Sitefinity users table which handles backend users and we have a customers database which is a seperate table that has no relationship with the Sitefinity user table. How can we handle multiple Membership Providers? I have a Customer Membership provider setup and it works independently but as soon as I try and login to the Sitefinity Admin site it tries to call routines in my Customer Membership.  What is going on?

    I have my membership provider defined in the web.config

        <membership defaultProvider="Default">
          <providers>
            <clear/>
    <add name="CustomerMembership" type="DynastyRogues.Data.CustomerMembership" connectionStringName="Sitefinity"  />
            <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity"/>
          </providers>
        </membership>

    I saw a few posts about this but none of them seemed to be answered that I had found. Help on this would be greatly appreciated.
  2. Jerami
    Jerami avatar
    12 posts
    Registered:
    31 Mar 2011
    30 Apr 2011
    Link to this post
    Little help please?
  3. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    03 May 2011
    Link to this post
    Hello Jerami,

    What is the base class of DynastyRogues.Data.CustomerMembership - is it like SqlMembebshipProvider? Could you use the base SqlMembebshipProvider class instead?

    All the best,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Wagner
    Wagner avatar
    21 posts
    Registered:
    05 May 2011
    05 May 2011
    Link to this post
    I have the same frustration here... trying to build a VERY simple custom membership but can't get it to work. It looks like that most tutorials/docs on how to do this are only valid with the old 3.x version of Sitefinity.
  5. Jerami
    Jerami avatar
    12 posts
    Registered:
    31 Mar 2011
    07 May 2011
    Link to this post
    I modified my Membership Provider to inherit SQLMembershipProvider...and I can log in to my users table now...but I then can't login to the Default Membership Provider of Sitefinity...it keeps trying to read from my CustomMembership Provider...how can I say if you login to the Front End use this membership provider and if you log into the Back End use the Sitefinity Membership Provider?
  6. Jerami
    Jerami avatar
    12 posts
    Registered:
    31 Mar 2011
    10 May 2011
    Link to this post
    Still only able to use one membership provider at a time. So basically if I have my custom membership provider in the web.config I cannot log into Sitefinity...but I can log in correctly to my custom database. So my workflow is keep both my membership providers in the web.config until I want to log into the backend...then take out my custom membership and do my work in Sitefinity. Then put my membership provider back in so users on the site can access restricted front end parts of the site. Not a real good workflow going on here.
  7. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    11 May 2011
    Link to this post
    Hi Jerami,

    Could you send us your web.config and the files in the App_Data/Sitefinity/Configuration folder? I will try to reproduce the issue locally.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Jerami
    Jerami avatar
    12 posts
    Registered:
    31 Mar 2011
    11 May 2011
    Link to this post
    Thanks for taking a look at this...I had to submit this via support ticket  423130
  9. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    11 May 2011
    Link to this post
    If you get this to work, can you repost your configuration files -- scrubbing anything secretive first, of course.

    I think I'm having the same issue. I can only get HttpContext.Current.User to get populated if I log into the backend, never through my alternate provider. But the forms authentication cookie is getting set.

    I wonder if I just need to get rid of the SF provider and just use my SQL/ASP.NET provider.

    Thanks
  10. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    13 May 2011
    Link to this post
    Hello Eric,

    You can't get rid of the default provider - it is named "Default" and will always be available.

    When you get the backend Login screen you should get a dropdown of all available membership providers that would allow you to log to the backend.

    When you login to the front-end are you using the Login control from the toolbox? It should allow you to select a provider against which to verify the username and password. 

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    17 May 2011
    Link to this post
    I'm using a custom control that has the regular ASP.NET login control. That control points to the custom provider. This works fine, it's just that the profile object is anonymous after logging in.
  12. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    19 May 2011
    Link to this post
    Hi Eric,

    You should make the following call to authenticate in Sitefinity:

    var reason = SecurityManager.AuthenticateUser("AspNetSqlMembershipProvider", this.LoginControl.UserName, this.LoginControl.Password, true);

    You could call this in the OnLoggedIn event handler of the <asp:Login> control - e.g.

    <asp:Login ID="LoginControl" runat="server" MembershipProvider="AspNetSqlMembershipProvider" OnAuthenticate="OnAuthenticate" OnLoggedIn="OnLoggedIn"></asp:Login>

    protected void OnLoggedIn(object sender, EventArgs e)
    {
        var reason = SecurityManager.AuthenticateUser("AspNetSqlMembershipProvider", this.LoginControl.UserName, this.LoginControl.Password, true);
        if (reason != UserLoggingReason.Success)
        {
            // Could not login for some reason
        }
    }

    Regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Jerami
    Jerami avatar
    12 posts
    Registered:
    31 Mar 2011
    23 May 2011
    Link to this post
    Just got this to work propertly.

    Basically I set up two membership providers in the web.config as follows:

    <membership defaultProvider="Default">
          <providers>
            <clear/>
            <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity"/>
            <add name="CustomerMembership" type="DynastyRogues.Data.CustomerMembership" connectionStringName="Sitefinity" enablePasswordRetrieval="false"
                                               enablePasswordReset="true" requiresQuestionAndAnswer="false"
                                               requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
                                               minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
                                               applicationName="/" />
          </providers>
        </membership>

    Then in my Custom Membership Provider I implemented the GetAllUsers method to this:

    public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
            {
                var coll = new MembershipUserCollection();
                totalRecords = 0;
     
                return coll;
            }

    Not sure why I had to do this but this was the method that was causing the sqawking. Initially this still didn't work I was still getting errors but that was because I had Integrated Windows Authentication checked in the Directory Security/Authentication Methods of my IIS6 website. I unchecked this and just had the Enable Anonymous Access checked. I was then able to accomodate the multiple membership providers.

    Also note my MembershipProvider had to implement SqlMembershipProvider.

    Hope this helps others.
13 posts, 0 answered