开发者

MembershipProvider and MembershipUser best practice

开发者 https://www.devze.com 2023-03-21 01:02 出处:网络
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'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:

  1. 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>)
  2. 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 ?
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消