Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

ProfileServiceManager Class

Configures a set of preloaded profile properties and the location of a custom implementation of the profile service.

Syntax

CSharp

[DefaultPropertyAttribute("Path")]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class ProfileServiceManager

VisualBasic

<DefaultPropertyAttribute("Path")> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class ProfileServiceManager

ManagedCPlusPlus

[DefaultPropertyAttribute(L"Path")]
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class ProfileServiceManager

JSharp

/** @attribute DefaultPropertyAttribute("Path") */
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal) */
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal) */
public class ProfileServiceManager

Members

IconMemberDescription
ProfileServiceManagerNew()Initializes a new instance of the ProfileServiceManager class.
Equals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Finalize()Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
GetHashCode()Serves as a hash function for a particular type. (Inherited from Object.)
GetType()Gets the Type of the current instance. (Inherited from Object.)
LoadPropertiesGets or sets an array that contains the profile properties that will be made available to client script.
MemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
PathGets or sets the path of a custom implementation of the profile Web service.
ToString()Returns a String that represents the current Object. (Inherited from Object.)

Remarks

The ProfileServiceManager class corresponds to the ProfileService property that can be added to the ScriptManager or ScriptManagerProxy control.

You can use ProfileServiceManager to specify a set of profile properties that will be preloaded when the page is rendered and will be available to client script. Also, instead of using the built-in profile Web service provided by Microsoft ASP.NET 2.0 AJAX Extensions, you can use this class to provide the path of an alternative implementation of the Web service that will be used for loading or saving profile properties from script.

To use the profile service in your application, you must enable it in the configuration file. If you use the built-in profile Web service and do not have to preload properties, you do not have to explicitly declare the profile service manager on the page.

To declaratively specify a set of preloaded properties, or a custom profile Web service, include a <ProfileService> element inside the <asp:ScriptManager> element on the page, as shown in the following example.

<asp:ScriptManager ID="SM1" runat="server">
  <ProfileService LoadProperties="propertyA,propertyB" Path="MyProfileService.asmx" />
</asp:ScriptManager>

You can also programmatically configure the profile service to preload properties or to use a custom profile Web service.

The following example shows the basic class structure that must be implemented in a custom profile Web service.

CS

<%@ WebService Language="C#" Class="MyProfileService" %>

using System.Web.Services;
using System.Collections.Generic;
using System.Web.Script.Services;

[ScriptService]
public class MyProfileService  : System.Web.Services.WebService 
{

    // Returns a dictionary containing a name-value
    // pair for all profile properties enabled for
    // read access found on the current users profile.
    [WebMethod]
    public IDictionary<string, object> GetAllPropertiesForCurrentUser() 
    {
        //Place code here.
        return null;
    }

    // Given an array of one or more property names,
    // returns a dictionary containing a name-value pair
    // for each corresponding property found on the current
    // users profile that are enabled for read access.
    [WebMethod]
    public IDictionary<string, object> GetPropertiesForCurrentUser(string[] properties)
    {
        //Place code here.
        return null;
    }

    // Given a dictionary with one or more name-value pairs,
    // sets the values onto the corresponding properties of
    // the current users profile. The method returns the count 
    // of properties that were able to be updated.
    [WebMethod]
    public int SetPropertiesForCurrentUser(IDictionary<string, object> values)
    {
        //Place code here.
        return 0;
    }

}

VB

<%@ WebService Language="VB" Class="MyProfileService" %>

Imports System.Web.Services
Imports System.Collections.Generic
Imports System.Web.Script.Services

<ScriptService()>  _
Public Class MyProfileService
    Inherits System.Web.Services.WebService

    ' Returns a dictionary containing a name-value
    ' pair for all profile properties enabled for
    ' read access found on the current users profile.
    <WebMethod()> _
    Public Function GetAllPropertiesForCurrentUser() As _
        IDictionary(Of String, Object)

        'Place code here.
        Return Nothing

    End Function

    ' Given an array of one or more property names,
    ' returns a dictionary containing a name-value pair
    ' for each corresponding property found on the current
    ' users profile that are enabled for read access.
    <WebMethod()> _
    Public Function GetPropertiesForCurrentUser _
        (ByVal properties() As String) As _
        IDictionary(Of String, Object)

        'Place code here.
        Return Nothing

    End Function

    ' Given a dictionary with one or more name-value pairs,
    ' sets the values onto the corresponding properties of
    ' the current users profile. The method returns the count 
    ' of properties that were able to be updated.
    <WebMethod()> _
    Public Function SetPropertiesForCurrentUser(ByVal values As _
        IDictionary(Of String, Object)) As Integer

        'Place code here.
        Return 0

    End Function

End Class

Permissions

  • AspNetHostingPermission

    for operating in a hosted environment. Demand value: LinkDemand. Associated enumeration: Minimal.

  • AspNetHostingPermission

    for operating in a hosted environment. Demand value: InheritanceDemand. Associated enumeration: Minimal.

Inheritance Hierarchy

Object

  • ProfileServiceManager

Assembly: System.Web.Extensions (Module: System.Web.Extensions)