asp.net.ph

ProfileSection Class

System.Web.Configuration Namespace


.NET Framework version 2.0

The ProfileSection class provides a way to programmatically access and modify the profile section of a configuration file. This class cannot be inherited.

ProfileSection Class Members

Collapse   Constructors

Visibility Constructor Parameters
public ProfileSection ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public AutomaticSaveEnabled Boolean [ Get , Set ]
public DefaultProvider String [ Get , Set ]
public Enabled Boolean [ Get , Set ]
public Inherits String [ Get , Set ]
public PropertySettings RootProfilePropertySettingsCollection [ Get ]
public Providers ProviderSettingsCollection [ Get ]

Remarks

The ProfileSection class provides a way to programmatically access and modify the profile section of a configuration file.

The profile section of the configuration file specifies a schema for user profiles. At run time, the ASP.NET compilation system uses the information specified in the profile section to generate a class called ProfileCommon, which is derived from ProfileBase. The ProfileCommon class definition is based on the properties defined in the profile section of the configuration file. The class allows you to access and modify the values for individual profiles. An instance of this class is created for each user profile, and you can access the individual profile values in your code through the HttpContext.Profile property.

Example

The following configuration file excerpt shows how to declaratively specify values for several properties of the ProfileSection class.

<system.web>
   <profile enabled = "true"
      defaultProvider = "AspNetSqlProfileProvider">
      <providers>
         <add name = "AspNetSqlProfileProvider"
            type = "System.Web.Profile.SqlProfileProvider"
            connectionStringName = "LocalSqlServer"
            applicationName = "/"
            description = "Stores and retrieves profile data from the local Microsoft SQL Server database" />
      </providers>
      <properties>
         <add name = "FirstName"/>
         <add name = "LastName"/>
         <add name = "FavoriteURLs" type = "System.Collection.Specialized.StringCollection, System"
            serializeAs = "Xml"/>
         <add name = "ShoppingCart" type = "MyCommerce.ShoppingCart, MyCommerce"
            serializeAs = "Binary"/>
         <group name = "SiteColors" >
            <add name = "BackGround"/>
            <add name = "SideBar"/>
            <add name = "ForeGroundText"/>
            <add name = "ForeGroundBorders"/>
         </group>
         <group name = "Forums">
            <add name = "HasAvatar" type = "bool" provider = "Forums"/>
            <add name = "LastLogin" type = "DateTime" provider = "Forums"/>
            <add name = "TotalPosts" type = "int" provider = "Forums"/>
         </group>
      </properties>
   </profile>
</system.web>
See Also

ASP.NET Configuration   <profile> Section Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph