ASP.net 2.0: Manage Web Users using a custom profile provider

Source: Internet
Author: User
Tags anonymous config new features

This article discusses:

ASP.net 2.0 configuration file Provider

Building a custom Provider

Authentication and authorization

This article uses the following techniques:

asp.net, XML

With ASP.net 2.0, you can add authentication, authorization, and various configuration files to your Web site without writing code. This is obviously a huge step forward compared with the past. As with most new features in ASP.net 2.0, authentication, authorization, and configuration files have their own built-in providers. You can view a provider as a module that contains the methods used to complete a particular task. These providers are very flexible, and you can customize them by specifying properties. These specified properties pass information to the provider so that it performs a different action behavior. However, if you have a high degree of customization, you may want to replace the built-in version with a custom or Third-party provider.

The asp.net configuration file feature allows developers to specify settings or data for each user. All of this data can be stored in an anonymous configuration file so that the settings are retrieved without the user logging on to the site. However, if the user creates an account, these settings can also be migrated to the logged in profile. You can also choose to turn off the anonymous profile feature.

To store a user's profile properties and retrieve them, simply name each profile property and add it to the profile element in the Web.config file, as shown in Figure 1. This puts the profile properties into the settingspropertyvaluecollection of the configuration file. You can also specify a data type and a default value for each property.

Figure 1 web.config configuration file partition

<profile>
<properties>
<add name= "FirstName"/>
<add name= "LastName"/>
T;add name= "Address1"/> <add name= "Address2"/> <add name= "city"/> <add
"state
" />
<add name= "Zip"/>
<add name= "Phone"/> <add name=
"profileversion" type= "int" def Aultvalue= "0" 

/>
</properties>
</profile>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.