<profile><properties> with no Profile class

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
 
G

Gregory A. Beamer \(Cowboy\) - MVP

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?
 
E

EdisonCPP

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
 
G

Gregory A. Beamer \(Cowboy\) - MVP

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.
 
S

Steven

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top