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

Forums / Migrating from 3.x to the latest Sitefinity version / Continuing to use OpenAccessMembership37Provider membership after upgrade from 3.6

Continuing to use OpenAccessMembership37Provider membership after upgrade from 3.6

6 posts, 0 answered
  1. Richard
    Richard avatar
    11 posts
    Registered:
    14 Sep 2011
    08 Feb 2013
    Link to this post

    Hi

    After an upgrade from 3.6 to 5.2 I can now access members and roles through the OpenAccessMembership37Provider via the API.

    What I now want to be able to do is allow members to log into the site via the standard asp:Login control. I think at the moment my settings must be such that I am using the default membership provider which means the OpenAccess members can't log in.

     I changed my membership default provider to the following in my web.config file

    <membership defaultProvider="OpenAccessMembership37Provider">
    <providers>
    <clear/>
    <add name="OpenAccessMembership37Provider" type="Telerik.Sitefinity.Modules.Migration.Security.Data.OpenAccessMembership37Provider, Telerik.Sitefinity.Migration"/>
    </providers>
    </membership>

    but this can't be quite right as I'm getting the following error

    Provider must implement the class 'System.Web.Security.MembershipProvider'

    Is someone able to point me in the right direction so that migrated users in the openaccess provider can log in via the asp:Login control?

    Also, I have just read a post (http://www.sitefinity.com/developer-network/knowledge-base/changing-the-default-membership-provider-after-migration-from-3-7-to-4-x) that states that all new users will be automatically saved under the default membership provider and best practise would be to migrate all existing users into the new default provider.

    Is this still the case, because I'm sure I've read elsewhere that the OpenAccessMembership provider can continue to be used. Maybe I missunderstood, but I assumed that this would mean that new members could be added to the same provider that existing members being to. We are not wanting to reset all member passwords if at all possible.

    Is someone please able to clarify this for me?

    Thanks for any help.

  2. Richard
    Richard avatar
    11 posts
    Registered:
    14 Sep 2011
    18 Feb 2013
    Link to this post
    Is anyone able to help me with this question?
  3. Michael
    Michael avatar
    41 posts
    Registered:
    07 Nov 2013
    29 Nov 2013 in reply to Richard
    Link to this post
    I have the same question. Sad that nobody answered yours. It seems these forums are not read very much.
  4. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    21 Nov 2016
    02 Dec 2013
    Link to this post
    Hi,

    Try the following settings in your web.config:
    <membership defaultProvider="OpenAccessMembership37Provider">
                <providers>
                    <clear />
                    <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity" />
                </providers>
            </membership>

    By default the Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider that we register is an implementation that allows us to provide support with the .NET MembershipProvider derived classes, so this entry should remain like it is.

    The OpenAccessMembership37Provider may not be enabled in your project, so you need to go to Administration->Settings->Advanced->Security->MembershipProviders and enable it (here is a screenshot). The web.config entry remains the same

    Now when you go to Administration->Users the list of the availble providers will be shown above the "Create a User" button and also when creating a user there is an option to decide where to create this user (here is ascrrenshot).

    Note that in Sitefinity 5.x and 6.x  the authentication is different that the authentication in Sitefinity 3.x. Sitefinity 3.x uses asp.net membership providers and the general asp.net approach, but in Sitefinity 5.x and 6.x the membership and role providers are still inheriting from asp.net built in providers, but the methods for authenticating a user are different this means using asp login control they will not work.

    A user in Sitefinity can be authenticated by calling the security API in Sitefinity:
    SecurityManager.AuthenticateUser("Default", "username", "password", true);

    Use SecurityManager to authenticate a user in Sitefinity from custom login control by inputting the username and password.

    Regards,
    Stefani Tacheva
    Telerik
    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
  5. Michael
    Michael avatar
    41 posts
    Registered:
    07 Nov 2013
    02 Dec 2013 in reply to Stefani Tacheva
    Link to this post
    Thanks Stefani.

    Since my user is in the OpenAccessMembership37Provider, I still had to call:
    SecurityManager.AuthenticateUser("OpenAccessMembership37Provider", userName, password, false);
    instead of "Default". I added the code in <asp:Login OnAuthenticate="...

    I also used "false" for the "persistent" parameter. I was getting some weird situation where apparently the user was still logged in somewhere else, but the ASP LoginName control was not showing the username (after I login and close and reopen the browser). BTW, I'm upgrading a 3.7 site to 6.2. So, I'm not rewriting all those controls, just trying to get them to work correctly.

    As for the change in Web.config, I did that. But as it relates to the API to login a user, I still have to pass the "OpenAccessMembership37Provider", so it's not useful in this case. I suppose if I have some other calls to the membership API elsewhere, then that code should use the OpenAccessMembership37Provider instead of Default automatically.

    Thanks,
    Michael

  6. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    21 Nov 2016
    05 Dec 2013
    Link to this post
    Hello,

    You could try to call:
    var validate = SecurityManager.AuthenticateUser(UserManager.GetDefaultProviderName(), "admin", "password", false);

    Regarding the migration of the controls all controls that you have created in 3.x ( that do not come out of the box in Sitefinity 4.x / 5.x/ 6.x ) need to be rewritten using our new API. You cal also use Sitefinity Thunder add - on for creating widgets and modules easily. You could take a look at this section of our Sitefinity documentation.

    We also have a KB article on how to migrate custom widgets to 4.x / 5.x/ 6.x:

    http://www.sitefinity.com/blogs/ivan-georgiev/posts/ivan-georgievs-blog/2011/12/02/custom_widgets_migration


    Have in mind that we have started version Sitefinity 4.0 from scratch. This let us revise the architecture from scratch and incorporate all lessons we learned while working on Sitefinity 3.X. Note that the differences in the architecture and structure ( and logic ) between the 3.x versions and the 4.x / 5.x/ 6.x are huge.

    The best option in your case would be, knowing the 3.x implementation and the final result of each control to redesign and recreate the controls in a way that you can achieve the same result in Sitefinity 4.x/ 5.x/ 6.x  In order to replicate the behavior of controls for the new Sitefinity website, I would suggest to review the following resources:

    1. Developer documentation.

    2. How to ( custom code samples )

    3. Our SDK

    4. Our Blogs, which contain posts with custom implementations.

    5. API reference.

    We have API reference, which can help you through the development process - if you want to get the latest release of the API reference document, you can check the following article, which contains a direct link for downloading the files:

    http://www.sitefinity.com/devnet/forums/developing-with-sitefinity-/api-documentation-for-sitefinity


    Regards,
    Stefani Tacheva
    Telerik
    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
6 posts, 0 answered