Membership Provider Class in ASP.Net

I have often read a common question in forum posts of the Membership provider class. So considering the preceding requirement and to explain the membership provider class I have decided to write this article. So Let us start from a definition so that beginners can understand.

ASP.NET Membership class

The ASP.NET Membership class is a part of the .NET Framework for application security that provides some features by default to create users, assign roles and assign authorization and authentication to user roles. It minimizes the effort of the developer in terms of coding because it provides the wizard to configure the membership settings.

The ASP.NET Membership class provides the following features:
  1. Wizard-based configuration for user management capabilities.
  2. Browser-based user management and access control configuration.
  3. The Membership and Roles classes that you can use to access user management capabilities within your code.
  4. A set of ASP.NET controls that provide users the ability to log on, log off, create new accounts and recover lost passwords  and so on.
  5. It uses ASP.NET and a database for configuration settings.
 This membership class provides the following static methods:
  1. CreateUser
  2. DeleteUser 
  3. FindUsersByEmail
  4. FindUsersByName
  5. GeneratePassword
  6. GetNumberOfUsersOnline
  7. GetUser 
  8. GetUserNameByEmail
  9. UpdateUser 
  10. ValidateUser 
Now let us become familiar with the preceding methods with a brief description as follows:
  •  CreateUser: This method adds a user to the database. Use this method if you create a custom page to enable users or administrators to add new accounts.
  •  DeleteUser: This method removes a user from the data store. Use this method if you create custom user management tools.
  •  FindUsersByEmail:This method gets a collection of membership users with the specified email addresses.
  •  FindUsersByName: This method gets a collection of membership users with the specified user names.
  •  GeneratePassword: This method creates a random password of the specified length. Use this if you are implementing custom controls to generate or reset passwords.
  •  GetAllUsers: This method returns a collection of all users in the database.
  •  GetNumberOfUsersOnline: This method returns the number of users currently logged on.
  •  GetUser: This method returns a Membership User object representing the current logged-on user. Call this method any time you need to access the current user's account.
  •  GetUserNameByEmail: This method gets a user name with the specified email address.
  • UpdateUser: This method updates the database with the information for the specified user. Use this method if you create a page to enable users or administrators to modify existing accounts.
  • ValidateUser: This method verifies that the supplied user name and password are valid. Use this method to check a user's credentials if you create your own custom logon controls.
Now from the preceding explanation you have learned about the membership provider class.
Note
  • This is a theoretical explanation about the membership class and my next article explains it practically.
  • I had kept the explanation brief so as to not confuse beginners.
Summary
From the preceding examples you have learned about the ASP.NET Membership Class. I hope this article is useful for all readers, if you have a suggestion then please contact me.

Post a Comment

www.CodeNirvana.in

Protected by Copyscape Online Copyright Protection
Copyright © Compile Mode