ASP.NET Profile Provider Not Working

G

Guest

I have added some profile properties to my web.config:
<profile enabled="true">
<properties><add name="firstname"/></properties>
</profile>
However when I try to access the property in a code behind it does not
exist. The following code does not work (says firstname is not a property):

Profile.firstname

I have rebuilt the solution. I am using VB.NET
 
J

Juan T. Llibre

re:
!> when I try to access the property in a code behind it does not exist.

You need to add the data type, too.

<profile enabled="true">
<properties>
<add name="firstname" type="string"/>
<add name="Country" type="string"/>
<add name="Gender" type="string"/>
<add name="Age" type="Int32"/>
</properties>
</profile>

Please review Scott Guthrie's Profile blog entry at :

http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx

Also, Scott Mitchell's 9-part membership tutorial helps a lot,
particularly part 6, for implementing custom profile properties :

http://aspnet.4guysfromrolla.com/articles/101106-1.aspx

Scott details other properties you can add which you might want to explore.

There's a code sample for the part 6 article at :
http://aspnet.4guysfromrolla.com/code/Membership.6.zip
 
G

Guest

Thanks Juan, I did read some of these posts, but my profile will still not
activate. Apprently when you add the properties to web.config the role
provider class gets recompiled. But this does not seem to happen for me.

In the meantime I have written my own profile table. I spent half a day on
it and had to move on.
 

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,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top