Updating an existing user profile in ASP.NET
See this article for details . Be aware that in some cases (see my comment on another answer), the ProfileCommon is not generated.
In this case, you need to revert to using ProfileBase:
ProfileBase profile = context.Profile;
DateTime dob= profile.GetPropertyValue("dob") as DateTime;
...
profile.SetPropertyValue("dob",dob);
source to share
When you are on the page, you have the ProfileCommon class available to access the profile. The profilecommon class is automatically generated by asp.net from your web.config profile settings when compiling your web project.
If you want to use a profile from the app_code folder, you will have to use the profilebase class. The profile available on the page is also derived from this class.
The profile base can be accessed as follows
HttpContext.Profile or HttpContext.Current.Profile
To read profile value you need to follow these steps
HttpContext.Profile.GetPropertyValue("propertyName");
To write the value to the profile you need to write
HttpContext.Profile.SetPropertyValue("propertyName", "propertyValue");
source to share
If what you are trying to do is update a different user profile (say you are the administrator who enters the customer's username), you can use something like the following.
Dim p As ProfileCommon = Profile.GetProfile("Usr1")
p.TestValue1 = "New Value"
p.TestValue2 = "Another New Value"
p.Save()
Again, if you are using a web project instead of a website, you will have to use p.SetPropertyValue () instead of typed names.
source to share
I have a similar problem and looking for a solution with sql script. This is a little more complicated, but it is possible if server-side code is not an option. I have set two fields in dbo.aspnet_Profile (PropertyValuesString, PropertyNames)
UPDATE dbo.aspnet_Profile
SET
PropertyValuesString = cast(Replace(cast(PropertyValuesString as nvarchar(max)),'New Value','Old Value') as ntext)
,PropertyNames='New calculated property names'
WHERE
UserId='userID'
The tricky part is changing the PropertyNames field. It contains the property of the profile name, start position and length. Something like this: address: S: 31:12 You have to recalculate the starting positions and the length according to the new value.
source to share