AquaLogic .NET Portlet Toolkit WSRP Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Accessing User Profile Information Using the .NET Portlet Toolkit

To access user profile information using the .NET Portlet Toolkit, add the properties to the Web.config file and reference them by name in the portlet page.

ASP.NET 2.0 introduced the Provider model as a design pattern for plugging data providers into the framework. The .NET Portlet Toolkit Portlet API uses the ProfilerProvider API to expose user profile information sent by a WSRP Consumer. For more information about the ProfileProvider model, see the MSDN documentation.

The Web.config file for a .NET portlet project contains a <profile> element that defines the user profile properties supported by a Provider. In order for user profile properties from the source application to be accessible from the ASP.NET Profile object, they must be registered in the Web.config file.

Note: User Profile information is read-only and can only be modified through the source application.
  1. For each custom property set or user profile grouping, create a <group> element in the <properties> element within the <profile> element in the Web.config file for the portlet project. Add each user profile property to its respective group. Each property must be defined with a name and a type. If you provide a default value, it will be used if the property is not available.
    Note: The name of the property must match the name sent by the source application. For more information about sending user profile properties from WebLogic Portal, see Developing User Profiles in the WLP documentation.
    <properties>
    	<group name="homeInfo">
    		<group name="online">
    			<add name="email" type="string"/>
    		</group>
    	</group>
    	<group name="CustomProperties ">
    		<add name="title" type="string" defaultValue="No Title"/>
    	</group>
    	<group name="MyProfile">
    		<add name="Name" type="String" defaultValue="Guest"/>
    		<add name="Age" type="Int32"/>
    	</group>
    </properties>
    
  2. Reference the property in the portlet page by name using the Profile object.
    string title = Profile.CustomProperties.Title
    string name = Profile.MyProfile.Name;
    int age = Profile.MyProfile.Age;
    
  3. Configure the .NET WSRP Producer to request user profile properties from the WSRP Consumer. Add a <user-profile> element to the end of the corresponding <portlet> element and configure the property names that should be passed to the WSRP Producer as shown in the example below. If you are using WLP, the properties from a property set can be filtered individually using a string with the format <propertyset-name>/<propertyname>. Using "*" for the <propertyname> will request all properties from a property set from WLP. (If you are using another WSRP Consumer, consult the related documentation for the correct syntax for user profile properties.)
    <user-profile>
      <item>CustomProperties/Title</item>
      <item>MyProfile/*</item>
    </user-profile>

  Back to Top      Previous Next