views:

44

answers:

3

Is it possible to have an ASP.NET website which allows users to register and login, without using a MembershipProvider?

And instead just work directly towards custom database tables which stores user information?

+2  A: 

You can, but why not use the MembershipProvider or your own bespoke Membership provider? It removes the need to think about how to code a lot of the details and is baked into the platform for this purpose. It is really quite straightforward to implement one and you need only override the methods that you need.

Russ Cam
Exactly. MembershipProvider is a model where you can provide your own implementation that does what you want. There are multiple defaults that come with the framework, and then lots of others available online. Just make a provider that reads from your custom tables, and then you will get all of the integration with ASP.Net for free.
Chris
+1  A: 

Absolutely. You can just do everything yourself. Although, I would question whether that is the best approach to take as it means doing a lot more work yourself when you can use what comes out of the box. Unless you have some special requirements?

Adam Pope
I was asking more out of interest. I like having control and know what each little part of my code does, and implementing the straight-out-of-the-box MembershipProvider feels like it would give me less control and overview of what's going on.
Jova
I would say that if you are a relatively inexperienced programmer then implementing it yourself would be a good learning experience, but if you want to get a project up and running, then the Membership Provider is the way to go. It doesn't do everything for you, there's still programming involved, it just does most of the boring heavy lifting and the important bit of checking for authentication.
Adam Pope
+1  A: 

Yey you can. Have a look at the FormsAuthentication class, specifically at the Authenticate, Signout and Session.Abandon Methods. You can write your own user privilege system in probably less time than you expect.

citronas