Profile not saving

  • Thread starter Thread starter Ismail
  • Start date Start date
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
 
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
 
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!
*********************************************
 
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
 
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
 
Back
Top