ProfileCommon could not be found

Ran into this little one today, when trying to specify additional properties in an ASP.net profile. I had the following in my web.config file for testing before adding additional properties.

 

<profile
enabled=“true“>

<properties>

</properties>

</profile>

I was then getting a missing reference error when i tried to do;

 

ProfileCommon p = (ProfileCommon) ProfileCommon.Create(CreateUserWizard1.UserName, true);

 

The problem is that ProfileCommon is a generated class, compiled only after you insert the <profile> section into your web.config file. However, the class is only compiled if you specify and additional property in the properties section, if you do not then the class is not compiled. The correct entry for web.config is;

<profile
enabled=“true“>

<properties>

<add
name=“dob“
type=“string“/>

</properties>

</profile>

Check out http://msdn.microsoft.com/en-us/library/ms998317.aspx and http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx for more info on forms authentication and asp.net profiles.

Advertisements
%d bloggers like this: