Click here to Skip to main content
12,444,360 members (52,253 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

6K views
Posted

Fixing ArgumentNullException When Using the ASP.NET Profile Feature in a Precompiled Site

, 8 Jun 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Essentially, leave 'Treat As Library Component Unchecked'

If you are seeing this error:

[ArgumentNullException: Value cannot be null.Parameter name: type]
System.Activator.CreateInstance(Type type, Boolean nonPublic)
System.Web.Profile.ProfileBase.CreateMyInstance(St ring username,Boolean isAuthenticated)
System.Web.Profile.ProfileBase.Create(String username, Boolean isAuthenticated)

And the Profile feature works on your development machine but not in production, there's a good chance that you're precompiling the website as a build release step.

To make sure the Profile feature keeps working, make sure that 'Treat As Library Component' is unchecked if using Web Redeployment Project. If you're using MSBUILD and the AspNetMerge Task, make sure the 'RemovedCompiledFiles' is set to false:

<AspNetMerge
          ExePath="$(FrameworkSDKDir)bin" 
          ApplicationPath="$(TempBuildDir)"
          KeyFile="$(_FullKeyFile)"
          DelaySign="$(DelaySign)"
          Prefix="$(AssemblyPrefixName)"
          SingleAssemblyName="$(SingleAssemblyName)"
          Debug="$(DebugSymbols)"
          Nologo="$(NoLogo)"
          ContentAssemblyName="$(ContentAssemblyName)"
          ErrorStack="$(ErrorStack)"
          RemoveCompiledFiles="false"
          CopyAttributes="$(CopyAssemblyAttributes)" 
          AssemblyInfo="$(AssemblyInfoDll)" 
          MergeXmlDocs="$(MergeXmlDocs)" 
          ErrorLogFile="$(MergeErrorLogFile)" 
          />

If you are not using a Precompiled site, but you are using a custom provider, check to make sure the library that contains your provider has been deployed correctly!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Martin Jarvis
Software Developer (Senior) Freestyle Interactive Ltd
United Kingdom United Kingdom
I'm a lead developer for Freestyle Interactive Ltd where we create many wonderful websites built on Microsofts ASP.Net and Ektron CMS.

I've been developing .Net applications (both Windows and Web) since 2002.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160811.3 | Last Updated 9 Jun 2010
Article Copyright 2010 by Martin Jarvis
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid