How to make Login Control use AspNetSqlMembershipProvider by

Posted by Community Admin on 03-Aug-2018 20:49

How to make Login Control use AspNetSqlMembershipProvider by default?

All Replies

Posted by Community Admin on 20-Jun-2011 00:00

I'm using SiteFinity 4.1 SP1 and have created a login page when users attempt to access pages that require authentication.

I should point out that I followed the instruction on setting up the AspNetSqlMembershipProvider using the following documenation (www.sitefinity.com/.../using_the_asp_net_sql_membership_provider_in_sitefinity.aspx) and everything is working correctly.

On  my login page, I have the default SiteFinity login control.  When i use this control, the default option is "Default" and will not use the AspNetSqlMembership provider to authenticate my user.

I have verified this by setting the AllowSelectMembershipProvider to True to show the Authentication drop down list.  When I show this and select the AspNetSqlMembership provider from the list, I'm able to log in just fine.

How can I change the behavior so that the AspNetSqlMembership provider is the default selected item?

I also attempted to fill in the "MembershipProvider" option for the login control to "AspNetSqlMembershipProvider".  However, when I have this entered, I get an error after entering the value username and password and clicking the login button.

How can I accompolish this?

Thanks,

Chris

Posted by Community Admin on 20-Jun-2011 00:00

Hello Chris,

The control has a property MembershipProvider - Gets or sets the name of the membership data provider used by the control that you can set to the provider you want to use.

When you set AllowSelectMembershipProvider you should see all providers which are defined for the application through web.config (for ASP.NET SQL provider) and SecurityConfig.config for Sitefinity's specific providers. To see your provider name in the drop down you should have at least one user created in this provider. The dropdown order is constructed by the result of UserManager.GetManager().Providers; Changing this order will require a custom control.

Greetings,
Ivan Dimitrov
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

Posted by Community Admin on 21-Jun-2011 00:00

Thanks Ivan for the information, but what I'm looking for is to "not" show the Drop Down control for users. 

I do see both the Default and AspNetSqlMembershipProvider in the Drop Down.

I would like for the users to be redirected to the login page when they attempt to access pages that require authentication and behind the scenes, without the user having to select a provider, to automatically use the AspNetSqlMembershipProvider.

Would I need to show this and then add some jQuery to change the selected value to the AspNetSqlMembershipProvider and the subsequently hide the Drop Down control?

If you could provide some guidance on how I can accomplish this?


Thanks,

Chris

Posted by Community Admin on 21-Jun-2011 00:00

Hi Chris,

If you set MembershipProvider property of the control to your custom provider the control will use only this provider. Here is the MSDN reference.

Regards,
Ivan Dimitrov
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

Posted by Community Admin on 21-Jun-2011 00:00

Ivan thanks for your persistence in making me double verify this.

I think the problem was that my pages were cached in the system.  I restarted my webserver, closed all my browsers and then restarted everything.  After those steps the behavior I desire is now working.

My login control can now use the AspNetSqlMembershipProvider to access membership protected pages in the site.

Thanks,

Chris

This thread is closed