Store Personalized Information
ASP.NET applications often have the need to store
user-specific information beyond the bare minimum username and password.
One way to solve this problem is to use the Session collection. Session state has two
limitations: it isn't permanent (typically, a session times out after 20
minutes of inactivity), and it isn't strongly typed (in other words, you
need to know what's in the session collection and manually cast
references to the appropriate data types). ASP.NET 2.0 addresses these
limitations with a new framework for storing user-specific data called
profile settings.
Note
Need to store some custom user-specific information for long periods of time? Why not use the membership data provider to save and retrieve information without resorting to database code.
How do I do that?
Profiles build on the same provider model that's used for membership and role management. Essentially, the profile provider takes care of storing all the user-specific information in some backend data store. Currently, ASP.NET includes a profile provider that's tailored for SQL Server.
Before you start using profiles, you should have a system in place for authenticating users. That's because personalized information needs to be linked to a specific user, so that you can retrieve it on subsequent visits. Typically, you'll use forms authentication, with the help of the ASP.NET membership services described in the lab "Easily Authenticate Users."
With profiles, you need to define ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access