Copied to clipboard

Flag this post as spam?

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


  • Marcus Abrahamsson 3 posts 23 karma points
    Nov 28, 2012 @ 21:44
    Marcus Abrahamsson
    0

    Custom Membership Provider

    Hi

    I need to implement a custom membership provider that validate users from an external database. From what I've learned so far it shouldn't be much more work than create a class that inherits from umbraco.providers.members.UmbracoMembershipProvider and overrides the ValidateUser() function.

    The next thing you do is to change the type of the membership provider to the namespace that my custom membership provider is in.

    My question is how web.config knows where to look for this file? Do I need to recompile the source code or should I just put the class that I created in the main folder for my umbraco project?

  • keilo 568 posts 1023 karma points
    Jun 21, 2014 @ 11:20
    keilo
    0

    Hi Marcus

    did you figure this out? Im on the same boat and clueless at this point...

  • Bruce 17 posts 82 karma points
    Jun 26, 2014 @ 11:47
    Bruce
    0

    So if you've created your custom membership provider by creating a class like this:

    using System;
    using System.Web.Security;

    namespace My.Library
    {

    public class MyMembershipProvider : MembershipProvider
    {

    }

    }

    And implemented the members/functions you need, specifically:

    public override bool ValidateUser(string username, string password) {}

    You then just need to update the web.config with the correct assembly info and make sure the membership provider is available to it (either as a compiled class library or as a class in app_code). Now either update the existing membership provider or add your own (and point the defaultProvider to it)

    <membership defaultProvider="MyMembershipProvider" userIsOnlineTimeWindow="15">
          <providers>
            <clear /><add name="MyMembershipProvider" type="My.Library.MyMembershipProvider" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="4" useLegacyEncoding="true" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed" />

     

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft