ASP.NET MVC Membership Provider Issues

This afternoon I struggled a little with an ASP.NET MVC 2.0 issue. I’m using NHibernate’s export schema capabilities to create my database schema. I have an NUnit project with a bunch of different tests with the sole purpose of re-creating the database and populating some dummy data so that I do not have to do so by hand. I wanted to take this a step further and create some users in my system using Microsoft’s in-built MembershipProvider. Having set up my tests, I received the following message:

'System.TypeLoadException : Could not load type 'OnlineAuctions.Core.Classes.BuyerMembershipProvider' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Obviously in this case the system is looking for my provider in the System.Web assembly, not my OnlineAuctions.Core assembly. My config file entry was as follows:

 

<add name="BuyerMembershipProvider" applicationName="OnlineAuctions" connectionStringName="mydevpc" minRequiredNonAlphanumericCharacters="0" passwordFormat="Encrypted" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" encryptionKey="aaavvvvaaabbbb" type="OnlineAuctions.Core.Classes.BuyerMembershipProvider” />

In retrospect this was a simple issue, but it took a little bit of playing before I fixed the issue. Can you see the issue? Yes, I am specifying my type in the type field – but I am not specifying the assembly in which the type resides. Adding the assembly, as in the below example, fixed the issue. Huzzar!

 

<add name="BuyerMembershipProvider" applicationName="OnlineAuctions" connectionStringName="mydevpc" minRequiredNonAlphanumericCharacters="0" passwordFormat="Encrypted" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" encryptionKey="aaavvvvaaabbbb" type="OnlineAuctions.Core.Classes.BuyerMembershipProvider, OnlineAuctions.Core” />

Comments

neunie said…
I had a similar problem and I vaguely remembered needing to put a ",". So I was looking for any post that would confirm my suspicion. Thanks for your help.

Popular posts from this blog

Mirth

Excel - Adding an existing Pivot table to the data model

Visual Studio 2012–Debug in Chrome Incognito Mode