Profile not saving

I

Ismail

Hello,

I am using asp.net20 membership. I have some properties in
web.config

<properties>
<add name="FirstName" type="System.String" allowAnonymous="true"/>
<add name="LastName" type="System.String" allowAnonymous="true"/>
<add name="JobTitle" type="System.String" allowAnonymous="true"/>

<properties>

in my update profile code i have

ProfileCommon pc =
(ProfileCommon)System.Web.Profile.ProfileBase.Create(Membership.GetUser().Email,
true);
pc.FirstName = MemberFirstName;
pc.LastName = MemberLastName;
pc.JobTitle = MemberJobTitle;
pc.Save();

I dont get any errors and nothing gets saved. When the member first
registers and enters these profile fields they are captured and saved
however when user later tries to update they cannot.

Anyone any ideas.

Thanks in advance.

Ismail
 
S

shapper

Hello,

I am using asp.net20 membership. I have some properties in
web.config

<properties>
<add name="FirstName" type="System.String" allowAnonymous="true"/>
<add name="LastName" type="System.String" allowAnonymous="true"/>
<add name="JobTitle" type="System.String" allowAnonymous="true"/>

<properties>

in my update profile code i have

ProfileCommon pc =
(ProfileCommon)System.Web.Profile.ProfileBase.Create(Membership.GetUser().Email,
true);
pc.FirstName = MemberFirstName;
pc.LastName = MemberLastName;
pc.JobTitle = MemberJobTitle;
pc.Save();

I dont get any errors and nothing gets saved. When the member first
registers and enters these profile fields they are captured and saved
however when user later tries to update they cannot.

Anyone any ideas.

Thanks in advance.

Ismail

If I am not wrong, you should authenticate the user first.

Cheers,
Miguel
 
C

Cowboy \(Gregory A. Beamer\)

Unless the email is also the user name, or you are using a custom profile
provider, you are not pulling up the user. You can test this in debug by
setting a breakpoint here:
pc.FirstName = MemberFirstName;

See if you have an object that is filled with your user.

The signature for Create is UserName, not email, so check this.

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

*********************************************
Think outside the box!
*********************************************
 
I

Ismail

Guys thanks for the replies,

Miguel the user is authenticated becuase you cannot get to this code
unless logged in and authenticated. Greg, The email is not the user
name but the user that I am pulling up is the correct user I can see
this from the name and last name and email properties. In the
web.config I have automaticSaveEnabled="false" does that need to be
true?

Regards

Ismail
 
I

Ismail

Greg,

I am an idiot!! You were on the right track I just changed the email
to username and all works.

Many thanks for this.

Regards

Ismail
 

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

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top