views:

323

answers:

3

I'm working on a website that will be using Facebook Connect to authenticate users. We also have some database structure on the backend to associate users via their Facebook user id to various groups and roles.

In short, the requirements for the project don't really have a lot of crossover with the functionality defined by ASP.NET's membership and roles provider model.

Given that, is there any reason to implement a custom membership provider for this stuff other than it working with the "built-in" stuff and having access to it via the Membership static class?

+5  A: 

Yes. It's very easy to implement a MembershipProvider (you really only need to implement the ValidateUser method) and you get access to some very useful asp.net features which at least simplify a lot of your code (I'm thinking of helpers like Page.User).

Ken Browning
+1 - couldn't agree more. For the amount of effort that it takes to create the providers, it's worth it.
Russ Cam
+1 - Just implement ValidateUser method.
Kjensen
A: 

Only if you want to use built-in or a third-party components based on ASP.NET's Membership model. If not - don't bother with this, as this will limit your application.

twk
Can you expand on how the application would be limited?
Ken Browning
You will have to stick with the Membership model provided by MS including 'out' variable references and exception handling.Of course it is quite easy to implement and is proved to be working well.I have used a self-bulid membership system, as well as the ASP.NET's one, and there is no real benefit for the MS in classic ASP.NET. For ASP.NET MVC it may have more sense to use the MS approach as the MVC is well combined with the Roles (views permissions as attributes).
twk
A: 

The membership APIs are a facade pattern, so you can swap in a different provider when Facebook goes the way of MySpace and is replaced with the next social networking fad.

So you'd implement a custom provider with Facebook as the back and swap it with other things for testing and future proofing.

By completely, how complete is your solution? The membership API's have cool stuff like a password generator, will keep track of who's online (by recency of login).

MatthewMartin