Setting up a profile is a pretty straightforward operation. You need a element in the Web.config fi le with a child element, and then you add one or more properties using elements. To group related properties, you use the element.
When you have set up the profile, you access its properties through the Profile property of the Page class. This always accesses the profile for the current user. Any changes you make to this profile are persisted for you automatically at the end of the ASP.NET life cycle.
By design, profile properties are accessible only to logged-in users. However, you can easily change this by turning on anonymous identification.
To access the profile of a user other than the one associated with the current request, you can use the GetProfile method. Any changes made to this profile are not persisted automatically, so you must call Save to send the changes to the database.
Now that your pages contain more and more code, chances are that bugs and problems will creep into your application. In the next chapter you learn how to use exception handling to avoid those problems from ending up in the user interface. You also learn how to debug your code, so you can fix problems before they occur.