Mulitple Membership Providers
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>
Little help please?
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,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.
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?
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.
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,Thanks for taking a look at this...I had to submit this via support ticket 423130
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
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.
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.
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
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
>
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
var coll = new MembershipUserCollection();
totalRecords = 0;
return coll;