Profiles: Can read any users but cannot write

G

Guest

Since the membership database is not easily (if at all) modified, I am
storing some key information in proviles for users. I need to create an admon
page so I can few and change this data as needed.

I have successfully read the profile data using the following code:

Dim context As New SettingsContext
context.Add("UserName", UserName)
Dim cl As New SettingsPropertyValueCollection
cl = ProfileManager.Provider.GetPropertyValues(context,
profileBase.Properties)
x=cl("UID").SerializedValue.ToString()

However, if I try to change the profile, I get an error

cl("UID").).SerializedValue = "33"
ProfileManager.Provider.SetPropertyValues(context, cl)

The error occurs on the last line and is:

[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.Profile.SqlProfileProvider.SetPropertyValues(SettingsContext
sc, SettingsPropertyValueCollection properties) +99

I have tried variations siuch as:

Dim p As SqlProfileProvider = ProfileManager.Provider
p.SetPropertyValues(context, cl)

and get the same error. Any insight would be appreciated.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top