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

Forums / General Discussions / How to make Login Control use AspNetSqlMembershipProvider by default?

How to make Login Control use AspNetSqlMembershipProvider by default?

5 posts, 1 answered
  1. Chris
    Chris avatar
    11 posts
    Registered:
    07 Mar 2011
    20 Jun 2011
    Link to this post
    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 (http://www.sitefinity.com/blogs/slavoingilizov/posts/11-04-20/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 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 "" 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
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jun 2011
    Link to this post
    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
  3. Chris
    Chris avatar
    11 posts
    Registered:
    07 Mar 2011
    21 Jun 2011
    Link to this post
    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
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Jun 2011
    Link to this post
    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
    Answered
  5. Chris
    Chris avatar
    11 posts
    Registered:
    07 Mar 2011
    21 Jun 2011
    Link to this post
    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
5 posts, 1 answered