I have been follow Steve Sandersons MVC2 book and have implemented a simple / custom MembershipProvider. You will not that a valid user has been hardcoded. My question is how do I get this to validate against my "Profiles" SQLServer table?
PS - I am using EF 4.1 Code First
Please see below:
public class Profile
{
[Key]
public int UserId { get; set; }
[Required]
public string UserName { get; set; }
[Required]
public string Password { get; set; }
}
public class SimpleMembershipProvider : MembershipProvider
{
private static List<Profile> Members = new List<Profile>
{
new Profile { UserId = 1, UserName = "admin", Password = "qwerty123" }
};
public override bool ValidateUser(string username, string password)
{
return Members.Exists(m => (m.UserName == username) && (m.Password == password));
}