In many applications, you want to store and use information that is
unique to a user. When a user visits your site, you can use the
information you have stored to present the user with a personalized
version of your Web application. Personalizing an application requires a
number of elements: you must store the information using a unique user
identifier, be able to recognize users when they visit again, and then
fetch the user information as needed. To simplify your applications, you
can use the ASP.NET profile feature, which can perform all of these
tasks for you.
The ASP.NET profile feature associates information
with an individual user and stores the information in a persistent
format. Profiles allow you to manage user information without requiring
you to create and maintain your own database. In addition, the ASP.NET
profile feature makes the user information available using a strongly
typed API that you can access from anywhere in your application.
You
can store objects of any type using profiles. The profile feature
provides a generic storage feature that allows you to define and
maintain almost any kind of data while still making the data available
in a type-safe manner.
You configure the profile feature by defining a list of properties whose
values you want to maintain. For example, you might want to store the
user's postal code so that your application can offer region-specific
information, such as weather reports. In the configuration file, you
would define a profile property named
PostalCode. The
profile section of the configuration file might look like the following:
When the user enters a postal code, you set a "profile
" property to store the value for the current user, as in the following example:
Profile.PostalCode = txtPostalCode.Text;
When you want to use the value, you can get it in much the same way that
you set it. For example, the following code example shows how to call
an imaginary function named GetWeatherInfo, passing it the current user's postal code as stored in a profile:
weatherInfo = GetWeatherInfo( Profile.PostalCode );
Please refer this MSDN article for more details.