What is Membership?

Source: Internet
Author: User

Differences from session

Membership generally refers to the use of Microsoft's aspnetdb database for identity authentication.

Session refers to the Session information of a Website user.

 


The Membership class provides the following functions:

Create a new user.

Store member qualification information (username, password, email address, and supported data) in Microsoft SQL Server or similar data storage areas.

Authenticate the users who access the website. Users can be authenticated programmatically, or a complete authentication system with few or no code is created using the Login control.

Manage passwords, including creating, changing, retrieving, and resetting passwords. You can choose to configure ASP. NET membership to require a password to prompt questions and their answers to perform identity verification for Password Reset and retrieval requests of users who forget the password.

Although ASP. NET membership is an independent function used for authentication in ASP. NET, it can be integrated with ASP. NET role management to provide site authorization services. The membership can also be integrated with the System. Web. Profile of ASP. NET users to provide application-specific custom implementations tailored to individual users. For more information, see role management and ASP. NET configuration file attributes.

The Membership class depends on the Membership provider communicating with the data source .. NET Framework includes a SqlMembershipProvider (storing user information in Microsoft SQL Server database) and an ActiveDirectoryMembershipProvider (allowed in Active Directory or Active Directory Application Mode (ADAM) store user information on the server ). A custom Membership provider can also communicate with other similar data sources that can be used by the Membership class. The custom membership provider inherits the abstract class of MembershipProvider. For more information, see implementing membership providers.

By default, ASP. NET membership supports all ASP. NET applications. The default membership provider is SqlMembershipProvider and is specified in the computer configuration with the name AspNetSqlProvider. The default instance of SqlMembershipProvider is a local instance connected to Microsoft SQL Server.

You can modify the default settings to specify the SqlMembershipProvider of a non-AspNetSqlProvider instance as the default provider, or use the Web. the config file specifies the User-Defined provider instance as ASP. the default provider of the. NET application. You can use the membership configuration section in the Web. config file to specify ASP. NET membership configurations for Web applications. You can use the providers subsection of the membership section to specify membership providers other than one of the default providers. For example, the following membership section removes the default membership provider from the current application configuration and adds a new provider named SqlProvider to connect to the SQL Server instance named MySqlServer.


 

1. <configuration>
 

1. <connectionStrings>
 

1. <add name = "SqlServices" connectionString = "Data Source = MySqlServer; Integrated Security = SSPI; Initial Catalog = aspnetdb;"/>
 

1. </connectionStrings>
 

1. <system. web>
 

1. <membership defaultProvider = "SqlProvider" userIsOnlineTimeWindow = "20">
 

1. <providers>
 

1. <remove name = "AspNetSqlProvider"/>
 

1. <add name = "SqlProvider" type = "System. web. security. sqlMembershipProvider "connectionStringName =" SqlServices "enablePasswordRetrieval =" false "enablePasswordReset =" true "requiresQuestionAndAnswer =" true "passwordFormat =" Hashed "applicationName ="/"/>
 

1. </providers>
 

1. </membership>
 

1. </system. web>
 

1. </configuration>

 

In ASP. NET applications, the Membership class is used to authenticate user creden。 and manage user settings (such as passwords and email addresses ). The Membership class can be used independently or together with FormsAuthentication to create a complete Web application or website user authentication system. The Login control encapsulates the Membership class to provide a convenient user authentication mechanism.

Www.2cto.com


The aspnetdb database is generally in the App_Data file.

Open the SQL Server-like operating database

The aspnet_Users in can store user information.

MenberShip can operate on this table

Sessions are all customized by you


From hi_dzj's column

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.