カスタムプロバイダーには次のようなものがあります。
namespace MyProject
{
public class SqlMembershipProvider : System.Web.Security.SqlMembershipProvider
{
private string ConnectionString { get; set; }
public override bool ChangePassword(string userName, string oldPassword, string newPassword)
{
//
}
public overrideMembershipUser CreateUser(string userName, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
{
//
}
private MembershipUser CreateUser(string userName, string password, object providerUserKey, out MembershipCreateStatus status)
{
//
}
public override bool DeleteUser(string userName, bool deleteAllRelatedData)
{
//
}
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
this.ConnectionString = ConfigurationManager.ConnectionStrings[config["connectionStringName"]].ConnectionString;
base.Initialize(name, config);
}
public override MembershipUser GetUser(string userName, bool userIsOnline)
{
//
}
public override bool ValidateUser(string userName, string password)
{
//
}
}
}
と:
namespace MyProject
{
public class SqlRoleProvider : System.Web.Security.RoleProvider
{
private string ConnectionString { get; set; }
public override void AddUsersToRoles(string[] userNames, string[] roleNames)
{
//
}
public override string ApplicationName
{
get
{
throw new NotSupportedException();
}
set
{
throw new NotSupportedException();
}
}
public override void CreateRole(string roleName)
{
throw new NotSupportedException();
}
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
{
throw new NotSupportedException();
}
public override string[] FindUsersInRole(string roleName, string userNameToMatch)
{
throw new NotSupportedException();
}
public override string[] GetAllRoles()
{
//
}
public override string[] GetRolesForUser(string userName)
{
//
}
public override string[] GetUsersInRole(string roleName)
{
throw new NotSupportedException();
}
public override bool IsUserInRole(string userName, string roleName)
{
//
}
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
this.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[config["connectionStringName"]].ConnectionString;
base.Initialize(name, config);
}
public override void RemoveUsersFromRoles(string[] userNames, string[] roleNames)
{
throw new NotSupportedException();
}
public override bool RoleExists(string roleName)
{
throw new NotSupportedException();
}
}
}