2

I'm writing a .NET command-line application that will migrate users from an existing database into aspnetdb. To simplify the user-specific settings, I'm using the profile class that Joel Spolsky wrote about here.

It works great in the ASP.NET MVC website, but for some reason it's throwing a TypeLoadException when being used from this new application. I'm not sure why the framework is trying to load the new class from System.Web.

Community
  • 1
  • 1
Jedidja
  • 16,610
  • 17
  • 73
  • 112

1 Answers1

3

It turns out that you need to be more specific in the app.config file. Instead of writing this

<profile defaultProvider="SqlProvider" inherits="MigrationFromUDF.AccountProfile">

you need to specify the name of your application (or assembly)

<profile defaultProvider="SqlProvider" inherits="MigrationFromUDF.AccountProfile, MigrationFromUDF">
Jedidja
  • 16,610
  • 17
  • 73
  • 112
  • I was sharing a custom profile provider between a MVC web project and an Azure Worker roles and spent ages trying to work out what was wrong. This answer was part of the solution. – NER1808 May 23 '12 at 10:10
  • Thanks for this, but I found it was part of the solution. I found that I also needed to be explicit declaring the assembly for the value of the section in the app.config on the work role. So that the type key reads 'type="my.custom.ProfileProvider, My.WorkRoleProject"' – NER1808 May 23 '12 at 10:17