30.4. Settings

In the .NET Framework v2.0, the concept of settings with a User scope was introduced to allow per-user information to be stored between application sessions. For example, window positioning or theme information might have been stored as a user setting. Unfortunately, there was no way to centrally manage this information. Meanwhile, ASP.NET Application Services had the notion of profile information, which was essentially per-user information, tracked on a server, that could be used by web applications. Naturally, with the introduction of the client application services, it made sense to combine these ideas to allow settings to be saved via the Web. These settings have a scope of User (Web).

As with the membership and role services, you need to enable the profile service for access by the client application services. You do this by adding the <profileService> element to the <system.web.extensions> element in the web.config file.

<system.web.extensions>
         <scripting>
                <webServices>
                        <profileService enabled="true"

readAccessProperties="Nickname"

writeAccessProperties="Nickname" />
                        <authenticationService enabled="true" requireSSL="false"/>

Following the previous examples, we will build a custom profile provider that will use an in-memory dictionary to store user nicknames. Note that this isn't a good way to track profile information, as it would be lost every time the web server recycled and would not scale out to multiple web servers. Nevertheless, you need to add a new ...

Get Professional Visual Studio® 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.