You would be surprised to know that there is a solution in CodePlex, that I have used a while back, to get a full-fledged working sample solution that implements Custom Membership Provider.
You can find the sample @ CodePlex in the following url. Note that this uses Razor model, and Entity framework.
For your followup question of how to enable custom providers in the configuration file, here are the steps.
a) Add a configuration file for your application. Web.config, to be precise.
b) Set up the default provider in the membership node. See below for sample.
<membership defaultProvider="providername" />
c) Add the Custom member Provider in the membership's provider collection.
<membership defaultProvider="provider name">
<add name="provider name" type="type of the provider" connectionStringName="con.string.name"
enablePasswordReset="true" maxInvalidPasswordAttempts="4" minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" writeExceptionsToEventLog="false" applicationName="/"
d) Add the Role Manager.
<roleManager defaultProvider="provider name">
<add name="provider name" type="type of the provider" connectionStringName="con.string.name" applicationName="/" />
Needless to say, your custom membership provider needs to implement the MembershipProvider class as shown in the example below.
public class myOwnCustomProvider :MembershipProvider
public override bool ValidateUser(string username, string password)
//place all your logic here.
Hope this helped.