I am using code that inherits SqlMembershipProvider, named MyMembershipClass so that I can make use of the functions.
I have created my inherited class and specified it in the Web.config file like so:
<membership defaultProvider="MyMembershipClass">
<providers>
<clear/>
<add name="MyMembershipClass" type="MyMembershipClass" applicationName="/"/>
</providers>
</membership>
Now that I have done that, to make use of the Membership functions, do I refer to it within my code as:
MyMembershipClass or just Membership?
EDIT:
If you refer to it at just Membership, is this due to defaultProvider="MyMembershipClass"?
Just as
Membership. It will automatically map to your defined membership class. That enables to change the provider later without needing to change all of your code.So you don’t have to write:
but
By the way, the same is true if you define a custom
RoleProvider, for example:Edit:
Yes, that must be the name of your class that inherits from
MembershipProvider(or another class inheriting from it likeSqlMembershipProvider).According to your second comment that you can define what you want even if it doesn’t exist, i get an exeption if i name the provider “Bob” in web.config: