Custom Providers






Custom Providers

The type attribute names the class you want to use to implement MembershipProvider. In Listing 5-6 above, it's set to the SqlMembershipProvider, but it could easily be set to a class that you write. For example, if you wanted to replace the account lockout feature of SqlMembershipProvider with a login delay, you could do that by starting with the source code for SqlMembershipProvider, modifying it however you like, and giving it a new name. (Although for this particular feature, you'll probably spend most of your time changing the stored procedures in the membership database.) You might be surprised to learn that the source code for all of the Microsoft providers for ASP.NET 2.0 are available to you royalty free,[12] and you are allowed to create derivative works under that license.

[12] If you'd like to download the source code, see http://msdn.microsoft.com/asp.net/downloads/providers/ or search for "ASP.NET Provider Toolkit."

Here's another helpful tip if you're planning on replacing the SQL provider or just learning more about how it works. You can ask aspnet_regsql to give you a dump of the SQL required to construct the provider tables, views, stored procedures, and so on. Here's the command (replace file.sql with the name of the output file that you want aspnet_regsql to create for you):

aspnet_regsql -A all -sqlexportonly file.sql

This creates a text file with all table, view, and stored procedure definitions, and you can search it to find out how things work under the covers. This is invaluable for the SqlMembershipProvider, as much of the actual functionality is provided by these stored procedures.



 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows