ASP.NET Profile Provider Not Working

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
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.
 
Back
Top