Search code examples
asp.netmembership-provider

Out-of-box membership provider for asp.net


Is there any out-of-box membership provider for ASP.NET?

Or is there any tutorial for creating one?

My problem is that I can't do any change to ASP.NET membership and I need some change on it.


Solution

  • Is there any out-of-box membership provider for asp.net?

    Yes, there's the default membership provider which uses SQL database. If you want to write a custom one you could inherit from the MembershipProvider class and implement the abstract methods you intend to use.

    For example:

    public class MyProvider: MembershipProvider
    {
        ... implement the abstract methods here
    }
    

    and then in your web.config replace the default provider with your own:

    <membership defaultProvider="Myprovider">
        <providers>
            <clear />
            <add name="MyProvider" type="MyNamespace.MyProvider, MyAssembly" />
        </providers>
    </membership>
    

    Here's an article on MSDN which explains the different methods of the membership provider that you need to implement and what are they used for.