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.
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.