ProfilePropertySettings.ReadOnly Property


Gets or sets a value that determines whether the associated property in the dynamically generated ProfileCommon class is read-only.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

[ConfigurationPropertyAttribute("readOnly", DefaultValue = false)]
public bool ReadOnly { get; set; }

Property Value

Type: System.Boolean

true if the associated property in the ProfileCommon class is read-only; otherwise, false. The default is false.

At run time, the ASP.NET compilation system uses the information specified in the profile section of the configuration file to generate a class called ProfileCommon, which is derived from ProfileBase. The class allows you to access and modify the values for individual user profiles.

The ProfileCommon class definition is based on the properties defined in the properties subsection of the profile section of the configuration file. The property values that you specify for an instance of the ProfilePropertySettings class will be used to define an associated property in the ProfileCommon class.

The following code example shows how to use the ReadOnly property. This code example is part of a larger example provided for the ProfileSection class.

// Get the current ReadOnly property value.
    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly);

// Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true;

.NET Framework
Available since 2.0
Return to top