Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0New Membership Provider ProblemNew Membership Provider Problem
Previous
 
Next
New Post
5/22/2007 9:52 AM
 

Here's a little background on my business requirements. We have a Microsoft CRM Solution for internal purposses and an installation of DNN 4.X for our public website. The business need is to have the users on DNN in synched with the contacts on CRM. So for every new user on DNN I have to create a new contact on CRM and for every user upgrade on DNN I have to upgrade the contact on CRM. The same thing goes the other way around. The good news is I have already implemented this solution and it works. I use an API that I created which updates CRM. The bad news is that the code lies on the code behind of the website, so with every upgrade of DNN, the code gets overwritten. This time I decided to take it one step further and create a new Membership Provider.

I don't need anything new other than calling my API when the user is updated or created so I decided to create a new project with a class that inherits from the already created DotNetNuke.Security.Membership.AspNetMembershipProvider. My provider then overrides 2 methods. Here's the code:

  DotNetNuke.Security.Membership
  Public Class IPPEAspNetProvider
    Inherits DotNetNuke.Security.Membership.AspNetMembershipProvider

    Dim
MyCrm As New CRM()

    Public
Overrides Function CreateUser(ByRef user As DotNetNuke.Entities.Users.UserInfo) As DotNetNuke.Security.Membership.UserCreateStatus
      Dim ret As DotNetNuke.Security.Membership.UserCreateStatus = MyBase.CreateUser(user)
      IppeCrm.User = user
      IppeCrm.CreateContact()
      Return ret
    End Function

 

End

 

Then on the web.config of the website I have the following:

 members defaultProvider="IPPEAspNetMembershipProvider">providers>clear/>add name="AspNetMembershipProvider" type="DotNetNuke.Security.Membership.AspNetMembershipProvider, DotNetNuke.Provider.AspNetProvider" providerPath="~\Providers\MembershipProviders\AspNetMembershipProvider\"/>add name="IPPEAspNetMembershipProvider" type="DotNetNuke.Security.Membership.IPPEAspNetMembershipProvider, DotNetNuke.Provider.IPPEAspNetProvider" providerPath="~\Providers\MembershipProviders\IPPEAspNetMembershipProvider\"/>providers>members>

When I browse to the website I get the following error:

 Value cannot be null.
Parameter name: type

[ArgumentNullException: Value cannot be null.
Parameter name: type]
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +2907419
   System.Activator.CreateInstance(Type type) +6
   DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey, Boolean UseCache) in Reflection.vb:227
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache) in Reflection.vb:189
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, Boolean UseCache) in Reflection.vb:76
   DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType) in Reflection.vb:60
   DotNetNuke.Security.Membership.MembershipProvider.CreateProvider() in MembershipProvider.vb:42
   DotNetNuke.Security.Membership.MembershipProvider..cctor() in MembershipProvider.vb:37

[TypeInitializationException: The type initializer for 'DotNetNuke.Security.Membership.MembershipProvider' threw an exception.]
   DotNetNuke.Security.Membership.MembershipProvider.Instance() in MembershipProvider.vb:48
   DotNetNuke.Entities.Users.UserController..cctor() in UserController.vb:59

[TypeInitializationException: The type initializer for 'DotNetNuke.Entities.Users.UserController' threw an exception.]

I'm totally clueless on what i'm missing. Maybe I forgot to incorporate something. Maybe someone can point me to a tutorial on how to create new providers. Any help is appreciated.

<

<

<

<

<

</

</

    Public Overrides Sub UpdateUser(ByVal user As DotNetNuke.Entities.Users.UserInfo)
      MyBase.UpdateUser(user)
      IppeCrm.User = user
      IppeCrm.UpdateContact()
    End Sub
End Class Namespace 

Namespace

 
New Post
5/22/2007 11:04 AM
 

Here's the code again:

Namespace DotNetNuke.Security.Membership
    Public Class IPPEAspNetProvider
        Inherits DotNetNuke.Security.Membership.AspNetMembershipProvider

        Dim IppeCrm As New CRM()

        Public Overrides Function CreateUser(ByRef user As DotNetNuke.Entities.Users.UserInfo) As DotNetNuke.Security.Membership.UserCreateStatus
            Dim ret As DotNetNuke.Security.Membership.UserCreateStatus = MyBase.CreateUser(user)
            IppeCrm.User = user
            IppeCrm.CreateContact()
            Return ret
        End Function

        Public Overrides Sub UpdateUser(ByVal user As DotNetNuke.Entities.Users.UserInfo)
            MyBase.UpdateUser(user)
            IppeCrm.User = user
            IppeCrm.UpdateContact()
        End Sub
    End Class
End Namespace

Web.config:

<members defaultProvider="IPPEAspNetMembershipProvider">
 <providers>
  <clear/>
  <add name="AspNetMembershipProvider" type="DotNetNuke.Security.Membership.AspNetMembershipProvider, DotNetNuke.Provider.AspNetProvider" providerPath="~\Providers\MembershipProviders\AspNetMembershipProvider\"/>
         <add name="IPPEAspNetMembershipProvider" type="DotNetNuke.Security.Membership.IPPEAspNetMembershipProvider, DotNetNuke.Provider.IPPEAspNetProvider" providerPath="~\Providers\MembershipProviders\IPPEAspNetMembershipProvider\"/>
 </providers>
</members>

 
New Post
5/22/2007 11:36 AM
 

jstawski,

The actual error (which isn't all that helpful) occurred in DotNetNuke.Security.Membership.MembershipProvider.Instance(). The first thing you will want to do is open your DNN solution and add the DotNetNuke (.dll) source project to your solution, remove the .dll reference and re-add the DotNetNuke (.dll) project reference. This way, you can set a breakpoint on DotNetNuke.Framework.Reflection.CreateObject(). Since this mechanism is used for loading all sorts of "provider" type classes you will see this run fairly often. This will allow you to narrow down who is calling this method with bad parameters. Most likely this will be a .config file problem or the dll containing the class isn't in the probing path for .NET.

Hope this helps,

Regards,

hk


Henry Kenuam
Engage Software
St. Louis, MO
314.966.4000



The leading provider of DotNetNuke support, training and custom module development
 
New Post
5/22/2007 2:47 PM
 

HK,

   Thanks for your help, but when I have the default membership provider as AspNetMembershipProvider I can step in the reflection code with no problem. When the provider is set to IPPEAspNetMembershipProvider I can't step into the reflection code. I can step into the PortalSettings.vb and when it tries to execute line 640 it fails. The line is Me.Users = objPortal.Users. I can step into objPort.Users, which then fails with the error mentioned above. I am not able to step into that code.

This must be a config issue.

 
New Post
5/24/2007 9:45 AM
 

Here are more findings. To make sure the issue was not related to an inheritance problem. I modified my code. I copied the entire code from AspNetMembershipProvider and paste it into my new provider. I made sure the references are all the same in both projects and just in case of some reflection thing, I copied the assemblyinfo.vb content into the new assemblyinfo.vb (I left the original guid.)  I compiled with no problems, added the dll into the dnn web project and I still get the same error. That rules out a problem with the membership provider and it means we should focus on the configuration side.

Any ideas?

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0New Membership Provider ProblemNew Membership Provider Problem


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out