MembershipProvider and MembershipUser best practice
I'm working on a website which has a Facebook Connect authentication. I want to add an internal registration and authentication system, so I'm looking for the MembershipProvider. I have some questions about ASP.NET Membership:
- Some methods (like GetUser) return a MembershipUser, I'm working with my own User object and I would like to 开发者_C百科return it instead of MembershipUser. Is there a generic MembershipProvider ? (e.g:
MembershipProvider<MyUser>
) - I need to add and to remove some parameters in CreateUser method (in MembershipProvider). If I add a new CreateUser method with only useful parameters in my CustomMembershipProvider, this method will not be accessible from Membership static class. What is the best way to do that ? Should I cast the Membership.Provider to access my provider ?
- My application design doesn't allow my User object to inherit from MembershipUser. Furthermore a lot of MembershipUser properties are useless for me and I don't want to have it in my User object.
Could someone help me ? What is the best practice to do that please ?
Have you considered using the Windows Identity Foundation SDK to provide user authentication instead of rolling your own? With this API you can offer not just Facebook, but also Google, Yahoo, Live and others as login options for your users.
精彩评论