Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michael Falch Madsen 70 posts 92 karma points
    Oct 07, 2013 @ 13:16
    Michael Falch Madsen
    0

    custom membership provider - umbraco 6.1.6

    Trying to implement a custom membership provider but its not working.

    Followed http://abrissirba.wordpress.com/2012/12/02/membership-provider-in-umbraco/

    Made class MyCustomMembership.cs

    using umbraco.providers.members;
    namespace MyMembershipProvider
    {
        public class MyCustomMembership : umbraco.providers.members.UmbracoMembershipProvider
        {
            public override bool ValidateUser(string username, string password)
            {
                if (username == "abrissirba")
                {               
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
    }

    Created a template with a standard login control

    <form runat="server">
    <asp:Login ID="Login1" runat="server" DestinationPageUrl="/home.aspx" InstructionText="" FailureAction="Refresh"></asp:Login>
    </form>

    Registred the provider in web.config

    <add name="UmbracoMembershipProvider" type="MyMembershipProvider.MyCustomMembership" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="_umbracoSystemDefaultProtectType" passwordFormat="Hashed" />

    When i debug my class in VS i get true and redirected to home.aspx but are presented the login form again?

    What steps am i missing?

    When i switch to the default membership provider and login with my dummy user it works fine



  • Hugo Migneron 32 posts 105 karma points
    Oct 15, 2013 @ 23:25
    Hugo Migneron
    0

    Did you figure it out? I am having the exact same problem. Only difference is that I am using Razor instead of Forms.

    EDIT: My problem was that when setting the forms authentication cookie, I was using a different username than the one umbraco was using (the different username came from the other database). Had nothing to do with umbraco, just the fact that authentication ticket won't work if you use it with the wrong username, which makes sense.

  • Dr. Sugus 26 posts 101 karma points
    Sep 25, 2014 @ 14:29
    Dr. Sugus
    0

    I'm digging up an old thread here, but this may be useful to others.

    It seems you are overriding the Members membership provider (frontend users) in stead of the Users membership provider (Umbraco users). It works for me if I use the Users membership provider. My solution is in Umbraco 7, so it looks like this:

    class MembershipProvider : Umbraco.Web.Security.Providers.UsersMembershipProvider
    
Please Sign in or register to post replies

Write your reply to:

Draft