ASP. NET security provider implementation (1) ASP. NET provider

Source: Internet
Author: User
ASP. NET provider

ASP. net2.0 provides various providers, such as membership, role, and profile, to facilitate management such as roles and users without writing code by yourself. These providers are also applicable in ASP. NET 4.0 and ASP. net mvc.

 

System. Web. Security. membershipprovider class

Defines the Agreement implemented by ASP. NET to provide Membership services using the custom membership provider.

Inheritance hierarchy:
System. Object
System. configuration. provider. providerbase
System. Web. Security. membershipprovider
System. Web. clientservices. providers. clientformsauthenticationmembershipprovider
System. Web. clientservices. providers. clientwindowsauthenticationmembershipprovider
System. Web. Security. activedirectorymembershipprovider
System. Web. Security. sqlmembershipprovider

ASP. NET membership is designed to allow you to easily use multiple membership providers for your ASP. NET applications. You can use the membership providers included in. NET Framework or implement your own providers.

When implementing a custom membership provider, you must inherit the abstract class of membershipprovider.

 

There are two main reasons for creating a custom membership provider:

  • The membership information needs to be stored in a data source not supported by the membership provider attached to a. NET Framework, such as The FoxPro database, Oracle database, or other data sources.
  • You must use a database architecture that is different from the database architecture used by the provider that comes with the. NET Framework to manage membership information. A common example is the existing membership data in the SQL Server database of the Company or website.

The abstract class of membershipprovider inherits from the abstract class of providerbase. The implementation of membershipprovider must also implement the members required by providerbase.

System. Web. Security. roleprovider class

Defines the agreements implemented by ASP. NET to provide role management services using custom role providers.

Inheritance hierarchy:
System. Object
System. configuration. provider. providerbase
System. Web. Security. roleprovider
System. Web. clientservices. providers. clientroleprovider
System. Web. Security. authorizationstoreroleprovider
System. Web. Security. sqlroleprovider
System. Web. Security. window#enroleprovider

ASP. NET role management is designed to allow you to easily use multiple different role providers for your ASP. NET applications. You can use the role provider attached to the. NET Framework or implement your own provider.

When implementing a custom role provider, you must inherit the roleprovider abstract class.

 

There are two main reasons for creating a custom role provider:

  • You need to store the role information in a data source that is not supported by the role provider attached to the. NET Framework, such as The FoxPro database, Oracle database, or other data sources.
  • You need to use a database architecture that is different from that used by providers in. NET Framework to manage role information. A common example is the existing role data in the SQL Server database of the company's network or website.
System. Web. profile. profileprovider class

Defines the Protocol implemented by ASP. NET to provide the configuration file service by using the custom configuration file provider.

Inheritance hierarchy:
System. Object
System. configuration. provider. providerbase
System. configuration. settingsprovider
System. Web. profile. profileprovider
System. Web. profile. sqlprofileprovider

The ASP. NET configuration file provides persistent storage and retrieval of user-specific attributes. The configuration file property values and information are stored in the data source in a way determined by the profileprovider. You can use the configuration file provider that comes with the. NET Framework (represented by a class derived from the profileprovider abstract class) or create a new class derived from profileprovider to implement your own provider.

There are two main reasons for creating a custom configuration file provider:

  • You need to store the configuration file information in a data source that is not supported by the configuration file provider attached to the. NET Framework, such as The FoxPro database, Oracle database, or other data storage.
  • You need to use a database architecture different from the database architecture used by the provider that comes with the. NET Framework to manage configuration file information. For example, user data already exists in the SQL Server database of the company network or website.

The abstract class of profileprovider inherits from the abstract class of settingsprovider, and the latter inherits from the abstract class of providerbase. The class that implements profileprovider must also implement necessary members of the settingsprovider and providerbase abstract classes. For more information about implementing the configuration file provider, see Implementing the configuration file provider.

 

Mvcquick provider

Microsoft provides support for sqlserver's implementation of membershipprovider, roleprovider, and profileprovider.

Mvcquick uses self-developed repositories, IOC containers, and log managers to implement membershipprovider, roleprovider, and profileprovider. This allows ASP. NET applications to support multiple types of data and improves application scalability and flexibility.

Source code download: http://mvcquick.codeplex.com/

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.