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