Personalization and Profiles 2008

download Personalization and Profiles 2008

of 21

Transcript of Personalization and Profiles 2008

  • 7/30/2019 Personalization and Profiles 2008

    1/21

    Personalization

  • 7/30/2019 Personalization and Profiles 2008

    2/21

    Many web applications must becustomized with the information that is

    specific to the end user who is presentlyviewing the page.

    Earlier this was done by using Cookies,

    Session or Application objects. Cookies enabled storage of persistent items

    so that when the end user returned to a web

    page any settings related to him wereretrieved.

  • 7/30/2019 Personalization and Profiles 2008

    3/21

    ASP.Net 2.0/3.5 provides you with a newfeature called Personalization.

    This feature can make an automatic associationbetween the end user viewing the page and anydata points stored for that user.

    The personalization properties that aremaintained on per user basis are stored on theserver and not on the client.

    These items are placed on the data store of your

    choice. This is good for creating highly customizable and

    user specific sites.

  • 7/30/2019 Personalization and Profiles 2008

    4/21

    The Personalization Model-

    There are 3 layers in this model The middle layer is called the Peronalization

    Service Layer.

    This layer contains the profile API.

    This layer helps you to program end usersdata points into one of the lower layer datastores.

    Also in this layer are included server controlspersonalization capabilities.

    Below this layer is the default PersonalizationData Provider for working with SQL Server.

  • 7/30/2019 Personalization and Profiles 2008

    5/21

    Creating Personalization Properties

    For creating Personalization Properties ,the first step is what data item from the

    user you are going to store.ASP.Net has a heavy dependency on

    storing configurations inside XML files.

    These customization points concerning theend user are defined and stored within theweb.config file.

  • 7/30/2019 Personalization and Profiles 2008

    6/21

    Within the element you define all the properties you

    want personalization engine to store. These properties can be for authenticated

    users or for anonymous users.

  • 7/30/2019 Personalization and Profiles 2008

    7/21

    Using Personalization Properties

    After defining the Personalization properties in

    the web.config file it is possible to use it inthe code.

    Using the Profile class.

    The same thing can be achieved using aSession Object but the personalizationproperties are not key based.

  • 7/30/2019 Personalization and Profiles 2008

    8/21

    Adding a group of Personalizationproperties

    If you want to store a large number ofpersonalization properties for a particularuser.

    These properties are not for a particular page

    but for the entire application. The items that you have stored about a

    particular user in the beginning can beretrieved at the end.

    The personalization engine enables you tostore your personalization properties ingroups.

  • 7/30/2019 Personalization and Profiles 2008

    9/21

  • 7/30/2019 Personalization and Profiles 2008

    10/21

    The personalization groups are definedusing the element within the

    element. Using Grouped Personalization properties

    You can access defined items in a logical

    manner using nested namespaces. Profile.MemberDetails.DateJoined

    Defining types for a Personalizationproperties

    By default these properties are created astype string.

  • 7/30/2019 Personalization and Profiles 2008

    11/21

  • 7/30/2019 Personalization and Profiles 2008

    12/21

    Providing default values

  • 7/30/2019 Personalization and Profiles 2008

    13/21

    This means that when you add a new enduser to the personalization property database,

    Member is defined instead of remaining ablank value.

    Making Personalization properties read-only-

  • 7/30/2019 Personalization and Profiles 2008

    14/21

    Anonymous Personalization

    Anonymous users can also utilize thepersonalization properties .

    This is important if a site requiresregistration.

    So end users do not always register for

    access to the greater application until theyhave first taken advantage of some basicservices.

  • 7/30/2019 Personalization and Profiles 2008

    15/21

    Many e-commerce sites allow anonymoususers to shop a site and use the sites

    shopping cart before the shoppersregister.

    Enabling Anonymous identification of theEnd User By default anonymous personalization is

    turned off because it consumes databaseresources.

    For anonymous user , information is stored by

    default as a cookie on the end users machine.

  • 7/30/2019 Personalization and Profiles 2008

    16/21

    Changing the Name of the Cookie

    Changing the length of the time the Cookie is

    stored

    Anonymous Option for Personalization Properties

    Once the capability for anonymous users are in place, you have to specify which personalization properties

    you want to enable for anonymous users .

  • 7/30/2019 Personalization and Profiles 2008

    17/21

    Migrating Anonymous Users

    You must be able to migrate anonymous

    users to registered users.

    For eg. After the user has selected items inthe cart he can register to purchase them.

    So at that moment he switches fromanonymous user to registered user.

    There is a profile_MigrateAnonymous event

    This event requires an event delegate of typeProfile_MigrateEventArgs.

  • 7/30/2019 Personalization and Profiles 2008

    18/21

    Determining whether to continue withAutomatic saves

    The page automatically saves the profilevalues to the specified data store at the endof the pages execution.

    This capability can be turned off by usingautomaticSaveEnabled=false in the element.

    Then you will have to invoke the

    ProfileBase.Save () method.

  • 7/30/2019 Personalization and Profiles 2008

    19/21

    Personalization Providers

    The Personalization API layercommunicates with a series of default

    data providers. By default it uses SQL Server Express.

    You are not restricted to this.

  • 7/30/2019 Personalization and Profiles 2008

    20/21

    Working with SQL Server Express Edition

    This is the default provider used by the

    personalization system provided by ASP.Net. In the App_Data folder it places an ASPNETDB.mdf

    file.

    In the machine.config there are sections that deal

    with how the personalization engine works withdatabase.

  • 7/30/2019 Personalization and Profiles 2008

    21/21

    The location of the file specified by theconnection string attribute points to therelative path of the file.

    In the section the personalizationengines reference to this connection string isspecified.

    A provider is added using the element.