Forums

 
  Support Forum  DNN General Dis...  Membership Prov...  Building your own Membership Provider for DotNetNuke and ASP.NET 2.0
Disabled Previous
 
Next Next
New Post 5/21/2007 10:10 AM
  Henry Kenuam
28 posts
9th Level Poster


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

roger,

When you say "initialize your project". Are you referring to when the constructor runs on your new membership provider class?

If you have your project in a solution in which your able to debug. Set a break point on the constructor for your new provider class. Most likely it is a typo or something wrong with your config file. Step through the code to find the exact cause of the error and post again as I may be able to provide more assistance.

regards,

hk


Henry Kenuam
Engage Software
St. Louis, MO
314.966.4000



The leading provider of DotNetNuke support, training and custom development.
 
New Post 5/23/2007 4:03 AM
  roger
8 posts
No Ranking


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

Hi hk:

Thanks for your reply in quick way.

i already create my membership project in the same solution of website. two class under the membership project have been setup, which i named for IV_membershipProvider.cs(replace aspnetmembershipProvider.vb) and IV_securitymembershipProvider.cs(replace aspnetsqlmembershipProvider.vb). both of them are empty class with only default outline. i add two references in the Reference folder of membership project(dotnetnuke.dll and notnetnuke.membership.dataprovider.dll) the same manipulation in website \bin folder should be (1.remove the dotnetnuke.provider.aspnetprovider.dll.   2. add the project to it) i also config the web.config in website as guildline from your <implementing membership and role providers in dotnetnuke> tutorial. but when i set my project as startup point to build , the page in totally blank. when i do the same thing in my website, also the same page occur as well , which replace the original page(notnetnuke default page).

i don't know what's the problem. any suggestion will be appreciated

thanks again

 
New Post 5/23/2007 9:09 AM
  Henry Kenuam
28 posts
9th Level Poster


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

roger,

Just so I understand, you have a new project which has your new membership provider class in it called: IV_membershipProvider.cs. This class extends the DotNetNuke.Security.Membership.MembershipProvider and has the signatures for all the methods in the class with no code (yet).

A couple of questions:

1. Does the project build without compilation errors?

2. When you run the site can you get to the login control(page)?

3. Can you set a breakpoint on ValidateUser() method in your class to verify that you have your project configured correctly and step through that code when you run the site?

WIth some more information I'm sure I can help get you going.

hk


Henry Kenuam
Engage Software
St. Louis, MO
314.966.4000



The leading provider of DotNetNuke support, training and custom development.
 
New Post 5/24/2007 3:24 AM
  roger
8 posts
No Ranking


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

hi hk:

i will answer your confusion in seperate step.

1.  Does the project build without compilation errors?

    yes, i can build my project on successful way

2. When you run the site can you get to the login control(page)?

   if i didn't add my project to the same solution of website and make the change to the bin folder, in which i just remove and add some references, i can logon the default dnn page, all of the function work well including login page. after my modification on above part, i can build my website without any error message,but the default dnn page become a blank page without anything display properly.

3. Can you set a breakpoint on ValidateUser() method in your class to verify that you have your project configured correctly and step through that code when you run the site?

   yes, when i only debug the method validateUser(), which located in AspNetMembershipProvider.vb, can run without error. because i think it's a default method existed in ASpNetMemebershipProvider folder in source file of dnn.

my puzzle is that i build my own MembershipProvider that mainly has the function to authenticate the user from my own database and add or delete user to my personal database rather than default dnn aspnet_* table,which is provided by aspnetmembshipprovider. if i only create a folder named such as IV_Membership Provider which contained only the files of aspnetmembershipprovider.vb and aspnetsqlmembershipprovider.vb without any change to the code in the sub-folder(MembershipProvider)of source folder.  does it work well?

i think at least i should change somethings in original aspnetmembershipprovider.vb such as the namespace to my own project(Company.Security.Membership)and change something in the method, because my own data table of user don't have the same attributes like the aspnet_user.

does it sound wrong or on the reverse way to my destination?

thinks your help !!! 

 
New Post 6/11/2007 12:25 PM
  Henry Kenuam
28 posts
9th Level Poster


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

Roger,

Please verify that your web.config has been updated accordingly (see document). You mentioned that if you change the references and update the \bin folder that it works just fine. As soon as you copy your new .dll into the \bin folder and remove the default one you will need to also update the web.config file to point to your new membership provider class and assembly.

Another option, you could just update the code in the default membership provider with your own. The down side is that if you upgrade, that the default membership provider .dll may be overritten. But that is certainly an option.

Hope this helps,

hk


Henry Kenuam
Engage Software
St. Louis, MO
314.966.4000



The leading provider of DotNetNuke support, training and custom development.
 
New Post 6/13/2007 9:06 AM
  roger
8 posts
No Ranking


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

hi hk:

first of all, thanks for your reply.

i still get confused of the configuration of  web.config file. my project will be in the situation as i described below:

1. i created the project called"IVMembershipProvider" within the the same "solution" of the dnn website.

2.under the project, i directly create three .cs file(IVMembershipProvider.cs, IVMembershipDataProvider. cs, IVRoleProvider.cs) which replace the default provider defined in dnn provider(AspNetMembershipProvider.vb,  AspNetSqlMembershipProvider.vb and DNNRoleProvider.vb) respectively.

3. I already write some necessary methods (override) to execute my function based on my customer membership provider. they can work well as i expected.

4. in the web.config file under the dnn website, i already modify some configure like:

a.

<

members defaultProvider="IVMembershipProvider">providers>clear/>add name="IVMembershipProvider" type="IVMembershipProvider.IVMembershipProvider, IVMembershipProvider.Provider.IVMembershipProvider" providerPath="~\Providers\MembershipProviders\IVMembershipProvider\"/>providers>members>

<

<

<

</

</

 

 

 

 

 

b.  c. above two points are the all place i made the modification to original web.config file 

<

roles defaultProvider="IVMembershipProvider">providers>clear/>add name="IVMembershipProvider" type="IVMembershipProvider.IVMembershipProvider, IVMembershipProvider.Provider.IVRoleProvider" providerPath="~\Providers\MembershipProviders\IVMembershipProvider\"/>providers>roles>

<

<

<

</

</

 

when i only run the project(set as startup project) the debug will be successful, then a blank page will be launched at the end.

when i run the website (set as the startup project) the debug also out of error. but the published page has error message like:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: type

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentNullException: Value cannot be null.
Parameter name: type]
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +2796723
   System.Activator.CreateInstance(Type type) +6
   DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey, Boolean UseCache) +223
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache) +803
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, Boolean UseCache) +56
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType) +36
   DotNetNuke.Security.Membership.MembershipProvider.CreateProvider() +40
   DotNetNuke.Security.Membership.MembershipProvider..cctor() +27

[TypeInitializationException: The type initializer for 'DotNetNuke.Security.Membership.MembershipProvider' threw an exception.]
   DotNetNuke.Security.Membership.MembershipProvider.Instance() +0
   DotNetNuke.Entities.Users.UserController..cctor() +20

[TypeInitializationException: The type initializer for 'DotNetNuke.Entities.Users.UserController' threw an exception.]
   DotNetNuke.Entities.Users.UserController.GetUserCountByPortal(Int32 portalId) +0
   DotNetNuke.Entities.Portals.PortalInfo.get_Users() +51
   DotNetNuke.Entities.Portals.PortalSettings.GetPortalSettings(Int32 TabId, PortalAliasInfo objPortalAliasInfo) +2830
   DotNetNuke.Entities.Portals.PortalSettings..ctor(Int32 tabId, PortalAliasInfo objPortalAliasInfo) +98
   DotNetNuke.HttpModules.UrlRewriteModule.OnBeginRequest(Object s, EventArgs e) +6423
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +167
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +117

Server Error in '/Website' Application.

Value cannot be null.
Parameter name: type

 

 i think there are should be something wrong in the web.config file. but i have no idea about it, could you give some suggestion, i will appreciate any advise

Thanks

 
New Post 6/13/2007 9:12 AM
  roger
8 posts
No Ranking


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

sorry, i will put the configure file again to keep it clear to you

  a. membersdefaultProvider="IVMembershipProvider">providers>clear/>addname="IVMembershipProvider"type="IVMembershipProvider.IVMembershipProvider, IVMembershipProvider.Provider.IVMembershipProvider"providerPath="~\Providers\MembershipProviders\IVMembershipProvider\"/>providers>members>

<
<
<
<
</
</
 
b.
<
<providers>clear/>addname="IVMembershipProvider"type="IVMembershipProvider.IVMembershipProvider, IVMembershipProvider.Provider.IVRoleProvider"providerPath="~\Providers\MembershipProviders\IVMembershipProvider\"/>providers>roles>
<
<
</
</
rolesdefaultProvider="IVMembershipProvider">

   

 

 
New Post 6/13/2007 10:17 AM
  Henry Kenuam
28 posts
9th Level Poster


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 
Modified By Henry Kenuam  on 6/13/2007 10:19:31 AM)

Roger,

 

 

I opened the project that you sent and I have some concerns listed below:

 

1. The project appears to be a c# library that contains both .cs and .vb files. A suggestion here, convert all your files to one language (per project).

 

2. The file AccessMembershipProvider currently does not compile as the functions and private data members are defined outside the Class definition.

 

3. I noticed that there is a login.aspx page in your project. I'm guessing you trying to test something with this? As if you implement your new provider correctly you would not need (or probably want) to replace the default DNN control.

 

4. The entries that I saw in the web.conf were in your project (.dll). These should be in the web.config of the DNN site that you are developing with.

 

I really want to help you here but I'm still not clear as to your intent here. Let me give you a scenario in which you could/should replace the membership provider (or any other providers for that matter).

 

You are entertaining the idea of using DNN for a project. You currently have a user base in another data store (Oracle, Access or an existing SQL server db). In this other store you have user related information i.e. email, passwords and so on. You can replace the ASPNetMembershipProvider class with your own. The end goal here is to “swap” out the provider for your own. DNN is none the wiser to this (or shouldn’t be). The login form remains “AS IS”. The difference is that your provider class has logic in it to perform all membership related functions i.e. ValidateUser().

 

An example of where you would find the file that you are replacing is here: C:\Inetpub\wwwroot\DotNetNuke\Library\Providers\MembershipProviders\AspNetMembershipProvider\AspNetMembershipProvider.vb.

 

I would suggest to start a new project and a new DNN install (4.4.1 as I know that later versions have changed). Take the above file and begin replacing the code to go to your Access DB or whatever. One by one replacing the logic until all calls to read/write to the default ASPNET_* tables are gone. Remember, you still have to make the calls to DNN specific tables as you can’t escape those (yet).

 

Hope this helps,

 

Regards,

hk

 


Henry Kenuam
Engage Software
St. Louis, MO
314.966.4000



The leading provider of DotNetNuke support, training and custom development.
 
New Post 6/19/2007 5:37 AM
  roger
8 posts
No Ranking


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

Hi hk:

I already change my projects as your instruction. the only problem should be misconfigure my webconfig file in the dnn website. if i keep the webconfig file as original setting, all module in dnn website can run smoothly. but when i change the membership in webconfig to point to my customized membership provider. there is one error occured in the webpage like:

Value cannot be null.
Parameter name: type

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: type

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentNullException: Value cannot be null.
Parameter name: type]
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +2796723
   System.Activator.CreateInstance(Type type) +6
   DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey, Boolean UseCache) +223
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache) +803
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, Boolean UseCache) +56
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType) +36
   DotNetNuke.Security.Membership.MembershipProvider.CreateProvider() +40
   DotNetNuke.Security.Membership.MembershipProvider..cctor() +27

[TypeInitializationException: The type initializer for 'DotNetNuke.Security.Membership.MembershipProvider' threw an exception.]
   DotNetNuke.Security.Membership.MembershipProvider.Instance() +0
   DotNetNuke.Entities.Users.UserController..cctor() +20

[TypeInitializationException: The type initializer for 'DotNetNuke.Entities.Users.UserController' threw an exception.]
   DotNetNuke.Entities.Users.UserController.GetUserCountByPortal(Int32 portalId) +0
   DotNetNuke.Entities.Portals.PortalInfo.get_Users() +51
   DotNetNuke.Entities.Portals.PortalSettings.GetPortalSettings(Int32 TabId, PortalAliasInfo objPortalAliasInfo) +2830
   DotNetNuke.Entities.Portals.PortalSettings..ctor(Int32 tabId, PortalAliasInfo objPortalAliasInfo) +98
   DotNetNuke.HttpModules.UrlRewriteModule.OnBeginRequest(Object s, EventArgs e) +6422
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +167
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +117

I don't know what's wrong with my webconfig file. could you help me to solve it ? i will send you the webconfig file to keep the problem more explicit to you

Appreciate you helping

Roger

 
New Post 6/30/2007 11:29 PM
  avvweb
1 posts
No Ranking


Re: Building your own Membership Provider for DotNetNuke and ASP.NET 2.0 

Same problem here. Is there any chance that you create some kind of tutorial with images and everything to do this custom membershp provider stuff? I know that this is to much for me to ask but it would be really useful.

Thanks

 
Disabled Previous
 
Next Next
  Support Forum  DNN General Dis...  Membership Prov...  Building your own Membership Provider for DotNetNuke and ASP.NET 2.0

Purchase

Please click here to buy now.
Payment will be processed via PayPal.

Test Drive!

Want to find out how it works? Visit our demo site to see the modules in actions!

Subscribe

Sign up for our newsletter and get the latest product updates!

Online Support

Powered by DotNetNuke