Normally, an instance of SqlMembershipProvider knows which application name to use by looking at the value of the applicationName configuration attribute. The default configuration in machine.config sets applicationName to /, so most developers will probably want to explicitly redefine membership providers in their applications to use a more suitable name. Many of the previous examples of extending SqlMembershipProvider showed configurations that used more appropriate values for applicationName.
The one constraint on the applicationName attribute, though, is that it is statically defined. After you set the value in configuration, the provider remembers that value for the rest of its lifetime. If you look at the MembershipProvider base class definition, though, you see that the ApplicationName property for the provider is abstract and that a setter is also defined. Concrete providers like SqlMembershipProvider can choose to implement the setter so that developers can change the application name at runtime.
This means that you can write code that switches between different application data living in the same Membership table with code like the following:
p = (SqlMembershipProvider)Membership.Provider; //assume default provider is SQL p.ValidateUser("someuser","somepassword"); p.ApplicationName = "A_Different_Value_Than_Configuration"; p.ValidateUser("some other user", "password");
p = CType(Membership.Provider, SqlMembershipProvider) ...