<profile><properties> with no Profile class

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

I have the following in my web.config:
<system.web>
<profile defaultProvider="MyASPSqlProfileProvider" enabled="true" >
<properties>
<add name="FirstName" defaultValue="" type="string"/>
<add name="MiddleInitial" defaultValue="" type="string" />
<add name="LastName" defaultValue="" type="string"/>
<add name="Address1" defaultValue="" type="string"/>
<add name="Address2" defaultValue="" type="string"/>
<add name="City" defaultValue="" type="string"/>
<add name="State" defaultValue=""/>
<add name="Country" defaultValue="" type="string"/>
<add name="PostalCode" defaultValue="" type="string"/>
<add name="Phone" defaultValue="" type="string"/>
<add name="NewsLetterOK" defaultValue="true" type="bool"/>
<add name="LastOrder" defaultValue="" type="System.DateTime"/>
</properties>
</profile>

When I compile, I don't get a Profile class. If I try to use it anyway
I get compiler errors. What am I doing wrong?

Using VS2008.

Every site I visit says you simple add <profile> with some properties
and VS will generate the Profile class for you.

Thanks,

Steven
 
First, I must say I am not particularly fond of the default implementation
of Profile. It is simple, but it is a tight box to fit into. It also errors
out and forces you to play games with Temporary ASP.NET files at times, but
deleting them generally clears things up.

At first blush, the config looks fine. What code are you using to try to
pull the ProfileCommon object?

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
I can't even do:
Profile.Anything

I just want to add a couple of fields to the default user information
in the database using CreateUserWizard and the Login control.

I wanted to assign the values in CreateUserWizard::CreatedUser() and
save them to the database.

I was under the impression I could do something like:
Profile.FirstName = txtFirstName.Text;
Profile.Save();

But I get no intellisense with Profile. and anything I try to do with it
says it doesn't exist.

I can do:
HttpContext.Current.Profile
but my new fields aren't in that instance.

Have I mis-interpreted something, or just done something wrong?

Thanks again!

Steven
 
The class that holds the autogen stuff is called ProfileCommon, not Profile.
Not sure why, but I have not looked at what is going on. You use it like
this:

ProfileCommon profile = (ProfileCommon)ProfileCommon.Create("UserNameHere",
true);

You can then get at the custom profile elements you have created.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
It's so odd. I found my temporary files, and the cs files have
the:

protected ProfileCommon Profile {
get {
return ((ProfileCommon)(this.Context.Profile));
}
}
for each of my files.

And the class ProfileCommon definition file, yet in my project
I can't seem to use ProfileCommon or Profile. They're not
in my autocomplete, and they won't compile. The ProfileCommon
definition file matches my web.config prefectly.

Can I just delete my temporary files and recompile?

Steven
 
Back
Top