Profile. Have no idea what I am doing wrong ...

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have an ASP.NET page and in its runtime code I am trying to get an
user profile, change it and save it.

It works if I use Profile, which is the profile for the current
authenticated user. But I want to change the profile of another user.

Anyway, I am using:

1 Dim pcProfile As ProfileCommon =
CType(ProfileCommon.Create(Username), ProfileCommon)
2
3 ' Update personal
4 With pcProfile.Personal
5 .Blog = tbBlog.Text
6 .Homepage = tbHomepage.Text
7 .Name = tbName.Text
8 End With
9
10 pcProfile.Save()

This is not working.

What am I doing wrong?

Thanks,

Miguel
 
The idea behind the ASPNET default membership, roles and profile providers
is a self-serve shop. Everything is focused on this scenario. This does not
mean it does not work with a call center type scenario, where you have your
own users help other users change things, but you step into a fringe
condition any time you are not on the primary model (self serve).

Whenever you step outside of the default condition, it is better to code
custom providers.

In your case, set a breakpoint first and make sure you are actually pulling
up a profile. There are a couple of ways at getting to a profile. You have
one in your sample. There is the static ProfileManager class, which works
quite nicely for pulling. And, you can go through Membership and use other
elements to pull the correct profile (most likely overkill for your
scenario, but it can set up a good double check on objects). THe biggest
thing to ensure is you are actually pulling a profile.

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

*********************************************
Think outside the box!
*********************************************
 
The idea behind the ASPNET default membership, roles and profile providers
is a self-serve shop. Everything is focused on this scenario. This does not
mean it does not work with a call center type scenario, where you have your
own users help other users change things, but you step into a fringe
condition any time you are not on the primary model (self serve).

Whenever you step outside of the default condition, it is better to code
custom providers.

In your case, set a breakpoint first and make sure you are actually pulling
up a profile. There are a couple of ways at getting to a profile. You have
one in your sample. There is the static ProfileManager class, which works
quite nicely for pulling. And, you can go through Membership and use other
elements to pull the correct profile (most likely overkill for your
scenario, but it can set up a good double check on objects). THe biggest
thing to ensure is you are actually pulling a profile.

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

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

Hi,

Something is wrong here!
I debugged everything and the Username is ok and the pcProfile gets
all the values in my profile has expected.
The only problem is that the changes are not saved in the profile when
I make:

pcProfile.Save()

Any idea?

Thanks,
Miguel
 
Back
Top