I read a couple of pages about "Membership" class and "Membership Provider" but I am not sure if I understand it. From all that I've read, I understand that if I want to use the "Membership" class I must initialize membership provider in web.config. This Membership class works with the "type" attribute in provider in this case with "System.Web.Security.SqlMembershipProvider". Am I right ? I need some simple and good explanation about Membership class, the name "AspNetSqlMembershipProvider"(in providers in membership) and System.Web.Security.SqlMembershipProvider.
(In this example I use the Database from file "aspnet_regsql.exe")
Example:
<connectionStrings>
<add name="UsersConnectionString" providerName="System.Data.SqlClient"
connectionString="Data Source=OWNER;Initial Catalog=LoginsDB;Integrated Security=True" />
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="UsersConnectionString"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="3"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
1.How Membership class work and know where to put information in specific fields in database ?(For example if I use "Membership.CreateUser("admin", "admin")")
2.Why when I change the name in "add name="AspNetSqlMembershipProvider"" the application doesn't want to work. Is this some unique name ?
3.What is "System.Web.Security.SqlMembershipProvider" ? Is this class works in conjuction with "Membership class"
4.What is this database which is generated from "aspnet_regsql.exe" file ? is it prefer to use it when creating registration page ?
1.How Membership class work and know where to put information in specific fields in database ?(For example if I use "Membership.CreateUser("admin", "admin")")
The concrete class System.Web.Security.SqlMembershipProvider
, which inherits from System.Web.Security.MembershipProvider
overrides MembershipProvider
methods and properties with implementations which target a specific database schema (namely LoginsDB's schema )
2.Why when I change the name in "add name="AspNetSqlMembershipProvider"" the application doesn't want to work. Is this some unique name ?
I guess so. I must confess I never tried that. I am using CustomMemberShipProvider, and never noticed a problem with the name.
3.What is "System.Web.Security.SqlMembershipProvider" ? Is this class works in conjuction with "Membership class"
It is an implementation of the abstract class System.Web.Security.MembershipProvider
4.What is this database which is generated from "aspnet_regsql.exe" file ? is it prefer to use it when creating registration page ?
If you use SqlMemberShipProvider, you don't really have any choice.
Depending on you framework version, you may also find give a look SimpleMemberShipProvider : http://msdn.microsoft.com/fr-fr/library/webmatrix.webdata.simplemembershipprovider%28v=vs.111%29.aspx