1 / 12

Personalizing Web Sites

Personalizing Web Sites. Nasrullah. Understanding Profile. The ASP.NET application service that enables you to store and retrieve information about users to your site. Continued.

tasha
Download Presentation

Personalizing Web Sites

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Personalizing Web Sites Nasrullah

  2. Understanding Profile • The ASP.NET application service that enables you to store and retrieve information about users to your site

  3. Continued You access the information in a user’s profile through a clean API with virtually no code. All you need to do is define the information you want to keep track of in the central web.config file and the Profile feature takes care of the rest. All interaction with the database to retrieve or store profile information in the database is handled automatically for you.

  4. Enabling profile • 1. Define the information you want to store for a user in the web.config file. Based on this information, the ASP.NET runtime generates and compiles a class for you on the fly that gives you access to the properties you defined. It then dynamically adds a property called Profile to the pages in your web site, so you can easily access it from every page in your site. 2. In your application you program directly to this generated class to get and store the profile information for the current user.

  5. Configuring profile • Because data about the logged-in user is stored in a cookie by default, your users need to have browsers that support cookies for the ASP.NET Profile feature to work correctly.

  6. Configurnig a profile You define a profile for your web site in the web.config file by creating a <profile> element as a direct child of the <system.web> element. Between the <profile> tags you need to create a <properties> element that is used to define the properties you want to expose from your Profile object. Two types of properties exist: simple properties and complex properties, referred to as profile groups.

  7. Configuring a profile <system.web> ... <profile> <properties> <add name=”FirstName” allowAnonymous=”True” /> <add name=”DateOfBirth” type=”System.DateTime” /> </properties> </profile

  8. Attributes of <add> element

  9. Configuring profile • When you define profile properties in web.config, the ASP.NET runtime creates a class for you in the background. This class, called ProfileCommon,givesyou access to the strongly typed properties such as FirstName, LastName, and FavoriteGenres. The ProfileCommon class is then made accessible to the Page through its Profile property

  10. Reading from profile • Reading from the profile is just as easy; all you need to do is access one of its properties FirstName.Text = Profile.FirstName; PostalAddressStreet.Text= Profile.PostalAddress.Street;

  11. ASP.NET Profile provider • The ASP.NET provider responsible for storing and retrieving profile related data

  12. Anonymous identification • The ASP.NET feature that enables you to track users to your site, even if they haven’t signed up for an account or are not logged in

More Related