views:

273

answers:

0

I have a custom Membership provider that implaments only the bool ValidateUser(string username, string password) method on System.Web.Security.MembershipProvider

This method uses a LINQ to SQL class to check the username and password as such:

MyDataContext ctx = new MyDataContext();

bool valid = ctx.Users.Where(u => u.userId == username && u.password == password).SingleOrDefault() != null;

return valid;

After logging in to the default Silverlight app (with a valid user) created with the "Business Application" template, the method is called but then the error *A profile property does not exist for User_Id* is thrown.

Trying to log in with incorrect details just prompts the user to try again.

If I add an entry for the profile in web.config, I then get an error about the other fields in the class (User.Contact_Id and then other fields).

<profile>
  <properties>
    <add name="FriendlyName"/>
    <add name="userId"/>
    <add name="password"/>
    **<add name="User_Id"/>**
  </properties>
</profile>

Now, if I change the bool ValidateUser(string username, string password) method to just return true, no error about profiles appears.

Why does it want to store all the User class members in the profile when the only place its used does not even return that class outside of the method?