Add a .NET Profile Property (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

Add a .NET profile property when you want to store and use information that is unique to a user. You can then use the information you have stored to present the user with a personalized version of your application.

noteNote
Adding a configuration setting adds the setting at the local level and to any child levels that inherit the setting.

For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Custom Controls Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, double-click .NET Profile.

  3. In the Actions pane, click Add Property to add a .NET profile property or, to add a .NET profile property to a group, select the group to which you want to add the .NET profile property, and then click Add Property To Group.

  4. In the Add .NET Profile Property dialog box, type a name for the .NET profile property in the Name text box.

  5. Under Data Type, select one of the following data types:

    • System.Boolean: to configure the .NET profile property to have a value of either True or False.

    • System.Char: to configure the .NET profile property to contain Unicode Characters.

    • System.DateTime: to configure the .NET profile property to contain dates and times with values that range from 12:00:00 midnight, January 1, 0001 Anno Domini (A.D.) or Common Era (C.E.) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.)

    • System.Decimal: to configure .NET profile property to contain decimal numbers that range from positive 79,228,162,514,264,337,593,543,950,335 to negative 79,228,162,514,264,337,593,543,950,335. The Decimal value type is appropriate for financial calculations that require many significant integral and fractional digits and no round-off errors.

    • System.Double: to configure the .NET profile property to contain a double-precision 64-bit number with values that range from negative 1.79769313486232e308 to positive 1.79769313486232e308, as well as positive or negative zero, PositiveInfinity, NegativeInfinity, and Not-a-Number (NaN). For more information about the Double value type, see Double Structure.

    • System.Int32: to configure the .NET profile property to contain a signed integer with a value that ranges from negative 2,147,483,648 through positive 2,147,483,647.

    • System.Int64: to configure the .NET profile property to contain an integer with a value that ranges from negative 9,223,372,036,854,775,808 through positive 9,223,372,036,854,775,807.

    • System.Single: to configure the .NET profile property to contain a single-precision 32-bit number with values that range from negative 3.402823e38 to positive 3.402823e38, as well as positive or negative zero, PositiveInfinity, NegativeInfinity, and Not-a-Number (NaN). For more information about the Single value type, see Single Structure.

    • System.String: to configure the .NET profile property to be a sequential collection of Char structures that represents a string of text. This is the default setting.

  6. In the Default value text box, type a value that the property will be initialized with.

  7. Under Serialization option, select one of the following serialization formatters:

    • String: Select this option when the settings property is serialized as plain text. This is the default setting.

    • XML: Select this option to serialize only public properties and fields. XML serialization does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an open standard, it is an attractive choice for sharing data across the Web.

    • Binary: Select this option to preserve type fidelity. Binary serialization is useful for preserving the state of an object between different invocations of an application. For example, you can share an object between different applications by serializing it to the Clipboard. You can serialize an object to a stream, to a disk, to memory, over the network, and so forth.

    • Provider Specific: Select this option when the settings provider has implicit knowledge of the property or its type and can pick an appropriate serialization mechanism. This is often used for custom serialization.

  8. Check the Read only box to configure the .NET profile property so that it cannot be modified.

  9. Check the Available for anonymous users box to make the .NET profile property available for unauthenticated users.

  10. Click OK.

To add a .NET Profile property, use the following syntax:

appcmd set config /commit:MACHINE /section:profile /+"properties.[name=' string ',type=' string ',defaultValue=' string ',serializeAs='String|Xml|Binary|ProviderSpecific',readOnly='True|False',allowAnonymous='True|False']"

The variable name string is the name of the profile property. The variable type string is the data type. The variable defaultValue string is the value with which the profile property will be initialized. The variable serializeAs 'String|Xml|Binary|ProviderSpecific sets the serialization formatter. The variable readOnly True configures the .NET profile property so that it cannot be modified. The default value is False. The variable allowAnonymous True makes the .NET profile property available for unauthenticated users. The default value is False. For example, to specify a profile property that holds a recent search list collection, type the following at the command prompt, and then press Enter:

appcmd set config /commit:MACHINE /section:profile /+"properties. [name='RecentSearchList',type='System.Collections.Specialized.StringCollection',serializeAs='Xml',allowAnonymous='true']"

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).

The procedure in this topic affects the following configuration elements:

<profile>

For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.

Use the following WMI classes, methods, or properties to perform this procedure:

  • None

For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.

See Also

Community Additions

ADD
Show: