asp.net.ph

Skip Navigation Links

<profile> Section

ASP.NET Syntax   ASP.NET Configuration Sections


.NET Framework version 2.0

Configures parameters for managing user profile values by using the ASP.NET profile.

<profile
   enabled = "true | false"
   inherits = "fully qualified type reference"
   automaticSaveEnabled = "true | false"
   defaultProvider = "provider name">
   <properties>...</properties>
   <providers>...</providers>
</profile>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes


Attribute Description
enabled Optional Boolean attribute.

Specifies whether ASP.NET user profiles are enabled. If true, ASP.NET user profiles are enabled.

The default is true.

defaultProvider Optional String attribute.

Specifies the name of the default profile provider.

For more information, see Provider.

The default is AspNetSqlProfileProvider.

inherits Optional String attribute.

Contains a type reference for a custom type that derives from the ProfileBase abstract class. ASP.NET dynamically generates an ProfileCommon class that inherits from this type and places it in the Profile property of the current HttpContext.

automaticSaveEnabled Optional Boolean attribute.

Specifies whether the user profile is automatically saved at the end of the execution of an ASP.NET page. If true, the user profile is automatically saved at the end of the execution of an ASP.NET page.

The ProfileModule object saves a user profile only if the module detects that the profile has been modified. That is, the IsDirty property is true. For more information, see ASP.NET Profile Properties.

The default is true.


Child Elements


Element Description
properties Required element.

Defines a collection of user profile properties and property groups.

providers Optional element.

Defines a collection of profile providers.


Parent Elements


Element Description
configuration Specifies the required root element in every configuration file that is used by the common language runtime and the .NET Framework applications.
system.web Specifies the root element for the ASP.NET configuration section.

Remarks

For information about accessing and modifying configuration values for the profile element in application code, see ProfileSection.

Default Configuration

The following default profile element is configured in the Machine.config file in the .NET Framework version 2.0.

<profile>
   <providers>
      <add name = "AspNetSqlProfileProvider"
         connectionStringName = "LocalSqlServer"
         applicationName = "/"
         type = "System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, 
            Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   </providers>
</profile>

Example

The following code example shows how to configure the Web.config file for an ASP.NET application to use a SqlProfileProvider provider.

<configuration>
   <connectionStrings>
      <add name = "SqlServices"
         connectionString = "Data Source=localhost;Integrated Security=SSPI;
            Initial Catalog=aspnetdb;" />
   </connectionStrings>

   <system.web>
      <authentication mode = "Forms" >
         <forms loginUrl = "login.aspx" name = ".ASPXFORMSAUTH" />
      </authentication>
      <authorization>
         <deny users = "?" />
      </authorization>
      <membership defaultProvider = "SqlProvider" userIsOnlineTimeWindow = "15">
         <providers>
            <clear />
            <add name = "SqlProvider"
               type = "System.Web.Security.SqlMembershipProvider"
               connectionStringName = "SqlServices"
               applicationName = "SampleApplication"
               enablePasswordRetrieval = "true"
               enablePasswordReset = "true"
               passwordFormat = "Encrypted"
               requiresQuestionAndAnswer = "true" />
         </providers>
      </membership>
      <profile defaultProvider = "SqlProvider">
         <providers>
            <clear />
            <add name = "SqlProvider"
               type = "System.Web.Profile.SqlProfileProvider"
               connectionStringName = "SqlServices"
               applicationName = "SampleApplication"
               description = "SqlProfileProvider for SampleApplication" />
         </providers>
         <properties>
            <add name = "ZipCode" />
            <add name = "CityAndState" />
         </properties>
      </profile>
   </system.web>
</configuration>
See Also

ASP.NET Configuration   ProfileSection Class



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

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