Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.NET 2 Provider Model and 3 Tier architecture

Status
Not open for further replies.

micheals

MIS
Dec 14, 2003
11
0
0
MY
Hi,

I am quite new with .NET 2 Provider Model.

I would like to customise SqlMembershipProvider since I have create a different database schema using MSSQL. I am thinking to inherit MembershipProvider and RoleProvider. However, my system is based on 3 Tier architechture. Where should I put the new inherited customised classes ? In Data Access Layer or Business Logic Layer or UI ?

These customised classes have access directly to DB. So I am thinking to put them in Data Access Layer. But how do I configure web.config ?

Maybe I have wrong concept. Anyone can guide me ?

Another question is regarding ProfileProvider. Do I need to use this provider for security access ?



Thanks.
 
It makes sense to consider it a DAL class. If you have an existing DAL that you want to isolate, there's nothing to say your implementation of a MembershipProvider/RoleProvider can't defer all actual data access to different classes and simply perform the business functions like validation and password encryption.

Anyway, it's pretty easy to reconfigure web.config. It looks something like this:

Code:
<roleManager defaultProvider="MyRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
    <providers>
	<clear/>
	 <add name="MyRoleProvider"  
            type="Namespace.RoleProviderName" 
            connectionStringName="MyConnectionStringName" 
            applicationName="Whatever" 
            writeExceptionsToEventLog="false"/>
     </providers>
</roleManager>
		
<membership defaultProvider="MyMembershipProvider" userIsOnlineTimeWindow="15">
    <providers>
        <clear/>
            <add name="MyMembershipProvider"
                type="Namespace.MembershipProviderName" 
                connectionStringName="MyConnectionStringName" 
                enablePasswordRetrieval="false" 
                enablePasswordReset="true" 
                requiresQuestionAndAnswer="false" 
                writeExceptionsToEventLog="false"/>
    </providers>
</membership>
 
Do I have to put your code for membership provider in the folder App_Code which in under the root of the application ? how can DLL find the custom membershipprovider in asp.net web.config ?
 
If you've ever used reflection and Type.GetType() before, it's like that.

For instance, by designating:

type="MyNamespace.MyClassName, MyAssemblyName"

...the provider will look for a type "MyClassName" which falls under the namespace "MyNamespace" which exists in a dll you put in the bin directory called "MyAssemblyName.dll".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top