ProfileGroupBase.Item Property (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets a grouped profile property value indexed by the property name.

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

Public Property Item (
	propertyName As String
) As Object


Type: System.String

The name of the grouped profile property.

Property Value

Type: System.Object

The value of the specified grouped profile property.

You can use this property to retrieve or set grouped property values of the user profile for your application. Returned values are typed as Object and must be cast as the specific object type when retrieved. For strongly typed access to profile property values, you can access the property by name as a member of a group of the HttpContext.Profile property, for example, Profile.Address.City.

The following code example shows an ASP.NET page that reads and sets the grouped properties specified for the user profile. For an example of a Web.config file that specifies a group of properties in the profile, see the example provided for the ProfileGroupBase class.

System_CAPS_security Security Note

This example contains a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<script runat="server">

Public Sub Page_Load()
  If Not IsPostBack Then
    StreetTextBox.Text          = Profile.Address.Street
    CityTextBox.Text            = Profile.Address.City
    StateTextBox.Text           = Profile.Address.State
    CountryOrRegionTextBox.Text = Profile.Address.CountryOrRegion
    ZipCodeTextBox.Text         = Profile.ZipCode
  End If
End Sub

Public Sub UpdateButton_OnClick(sender As Object, args As EventArgs)
  Profile.Address.Street          = StreetTextBox.Text
  Profile.Address.City            = CityTextBox.Text
  Profile.Address.State           = StateTextBox.Text
  Profile.Address.CountryOrRegion = CountryOrRegionTextBox.Text
  Profile.ZipCode                 = ZipCodeTextBox.Text
End Sub

<html xmlns="" >
<title>Home Page</title>
<h3>Address Information for <%=User.Identity.Name%></h3>
<form id="form1" runat="server">
  <table border="1" cellpadding="2" cellspacing="2">
      <td>Street Address</td>
      <td><asp:Textbox id="StreetTextBox" runat="server" columns="30" /></td>
      <td><asp:Textbox id="CityTextBox" runat="server" columns="20" /></td>
      <td><asp:Textbox id="StateTextBox" runat="server" columns="20" /></td>
      <td>Zip Code</td>
      <td><asp:Textbox id="ZipCodeTextBox" runat="server" columns="10" /></td>
      <td><asp:Textbox id="CountryOrRegionTextBox" runat="server" columns="20" /></td>
  <asp:Button id="UpdateButton" runat="server" OnClick="UpdateButton_OnClick" Text="Update Address" />


.NET Framework
Available since 2.0
Return to top