views:

268

answers:

2

I am working on splitting out an existing, working application that I currently have in order to better understand n-tier structures. This app uses a custom membership & role providers w/ forms authentication.

All Data access and business logic are all within the same ASP.Net solution currently.

I have built a Business Logic Layer (BLL) and a Data access layer (DAL) and I am extracting out the business logic. I am struggling as to where the MembershipProvider classes should exist.

  • Do the the Membership provider classes have to reside in the presentation layer because of the tight coupling of the built in UI controls (login, create user wizard etc.) that utilize these classes?

  • Can they exist in a BLL? If so, how do I reference them from the presentation? Is it just a matter of altering the web.config to point to the BLL.membershipprovider once the BLL is referenced from the UI?

Just trying looking for a sanity check before I go down the wrong path. Unfortunately I couldn't find any examples of this via google. Any help/pointers are appreciated.

+1  A: 

Membership classes can exist in any referenced assembly. Simply make sure you fully qualify the namespace and class names in configuration.

andrewbadera
+1  A: 

The web.config keys for the membership / providers node do allow you to specify a custom type, so with the proper namespace and assembly reference in that key, you can put your custom membership objects anywhere you see fit. I would suggest a separate DLL for the membership logic (objects that inherit off of the membership base classes), which references your BLL for all of the internal authentication logic.

http://msdn.microsoft.com/en-us/library/aa479048.aspx

Matt Hamsmith