System.Web.Profile.ProfileBase.SetPropertyValue Method

Sets the value of a profile property.

Syntax

public void SetPropertyValue (string propertyName, object propertyValue)

Parameters

propertyName
The name of the property to set.
propertyValue
The value to assign to the property.

Remarks

ASP.NET uses the System.Web.Profile.ProfileBase class to create the class used for the user profile. When an application that has the user profile enabled is started, ASP.NET creates a new class of type ProfileCommon, which inherits from the System.Web.Profile.ProfileBase class. Strongly typed accessors are added to the ProfileCommon class for each property defined in the profile configuration section. The strongly typed accessors of the ProfileCommon class call the ProfileBase.SetPropertyValue(string, object) method to pass property values to the System.Web.Profile.ProfileProvider to be stored at the data source.

You can use the ProfileBase.SetPropertyValue(string, object) method to assign property values in the user profile for your application by name. Values are untyped, and type checking will be done at run time, not compile time. For strongly typed access to profile property values, you can access the property by name as a member of the Profile property that is available on each page, for example, Profile.CustomerAddress.

Requirements

Namespace: System.Web.Profile
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0