Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

Today we released the source code for the built-in ASP.NET 2.0 Membership, Role Management, Site Navigation, Session State, Profile, Web Events, and Web Part Personalization providers (basically all of the built-in providers that ship in the .NET 2.0 Framework Redist).  You can download them here, and learn more about the ASP.NET 2.0 Provider Model from this site here.

The source code is released under a permissive license that allows both commercial and non-commercial re-use of the source code, and should be very useful both for people wanting to build their own custom providers (you can take our source and just tweak it if you want), or to better understand/debug our existing ones.

The provider source code comes with a buildable VS 2005 Project all setup.

Jeff Prosise also wrote 130+ pages of awesome whitepapers that walkthrough the code, database schema, and how they work.  You can read them here:

  • Microsoft ASP.NET 2.0 Providers: Introduction
  • Membership Providers
  • Role Providers
  • Site Map Providers
  • Session State Providers
  • Profile Providers
  • Web Event Providers
  • Web Parts Personalization Providers

    The beauty of the ASP.NET 2.0 Provider model is that it delivers rich extensibility and flexibility to the built-in productivity features you get with ASP.NET 2.0.  Out of the box with ASP.NET 2.0 you get a secure user management and role credential store (no need to write any database code -- just call Membership.CreateUser() or use the <asp:login> controls and you are good to go).  Because you can plug-in custom provider implementations, though, you also have the flexibility to customize the implementations in the future if you want (or adapt them to go against existing databases or stores that you already have with other applications).  Code written to the Membership APIs or <asp:login> controls will work regardless of what provider you have configured in your web.config file.

    To learn more the new ASP.NET 2.0 Security Features, please check out this post I did a month ago.  It provides links to tons of content (including a nice 12 minute video you can watch to learn how easy it is to add Membership and Roles to a site from scratch).  It also links off to a number of other providers (including Access and MySql ones) that people have already written.

    Hope this helps,

    Scott

    P.S. Earlier this month I blogged about a bunch of the cool ASP.NET releases we were doing this month, but I forgot to mention this one.... Sorry! :-)

  • Published Thursday, April 13, 2006 2:11 PM by ScottGu
    Filed under: , ,

    Comments

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 5:41 PM by Rob Gaudet
    WOW! This is great stuff. Been working with the limited functionality in the profile provider for a while now and can't wait to my grubby little fingers on the SqlProfileProvider!

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 5:47 PM by scottgu
    Hi Rob,

    There is also a really good Profile Provider here that maps profile properties to SQL columns and/or Stored Procedures: http://weblogs.asp.net/scottgu/archive/2006/01/10/435038.aspx

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 6:27 PM by Colin Blair
    Any chance on the code for ActiveDirectoryMembershipProvider getting released as well?

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 6:29 PM by George J Capnias
    I think it would be a nice idea to have Jeff Prosise's guides, availiable as download too...

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 6:37 PM by scottgu
    Hi George,

    I'll see if we can get download versions up there too. In the meantime, you can use the "Save As" feature in IE to copy all images stylesheets + html etc to save local copies.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 6:38 PM by scottgu
    Hi Colin,

    I'll check on the availability of that too.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 7:54 PM by Beevis
    The code for the ActiveDirectoryMembershipProvider would be awesome. Thanks for making this available for download...what a great resource and learning tool. Speaking of learning tools, I'd certainly benefit from some additional Starter Kits, I learned a ton from the original 1.1 kits. The 2.0 starter kits don't seem to be as good.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 9:47 PM by scottgu
    Hi Beevis,

    We recently published a few more starter kits here: http://www.asp.net/default.aspx?tabindex=5&tabid=41

    We have a long list of new ones that we are working on -- so so expect to see more and more soon.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 10:30 PM by Yuvi
    Man, this is awesome! Thanks a lot dudes.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 13, 2006 11:42 PM by Vikram
    Dear Mr. Scott,

    You said this about starterkits...

    "We have a long list of new ones that we are working on -- so so expect to see more and more soon."

    Since you are already informing WHATS NEW for the entire month. How about blogging about WHATS NEW in STARTERKITS.

    This will really help us

    # RossCode.com - ASP.NET Providers Source Code

    Friday, April 14, 2006 12:44 AM by TrackBack
    RossCode.com - ASP.NET Providers Source Code

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 14, 2006 9:16 AM by Gabe
    Thanks Scott, no better way to learn it then to read through the actual code...

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 14, 2006 9:17 AM by Dave Kekish
    Thanks for the source code. I'll have to go compare what I wrote against these.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 14, 2006 10:24 AM by Hua
    Hi Scott,
    You mentioned in this blog that we can tweak the source code of built-in providers. I have not have chance to look at the source code yet. I am wondering if we can change the signature of a function. For instance, for our case, we really want to change the createUser() to take more parameters if we can. I like to use the createuserwizard but I found I need to resort the event of CreatingUser to get my implementation to work. this happens in a project I just finshed and I need to face similar situation in my next project.

    Thanks
    Hua

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 14, 2006 11:31 AM by scottgu
    Hi Hua,

    You need to have the same signature for the Membership contract. But what you can do is add new methods with overloaded parameters. There is then a way to get access to them via the Membership API within an application.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 14, 2006 2:29 PM by Robert McKee
    All I can say is WOW! Very nice. I'll mark this off my wishlist. I'm glad that the .NET team really is listening to their users. I know this would have helped me out a ton, and I'm sure will help many many programmers be able to quick start their own providers, and understand the default ones much better. Hats off to you guys for doing this for us!

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Saturday, April 15, 2006 4:31 PM by Ed
    Wow, finally!!!

    First it was the db schema that needed illumination in documentation...but wan't terribly difficult (re: in SQL Server just create diagrams to view the relationships in Ent Mgr).

    But this is definitely the key! Thank you!

    On another note - as expected, asp.net blogs are an invaluable resource! - is there a way to include asp.net blogs into VS's help system? I'm saving time on your blog when it comes to documentation/guidance, and pointers to related content!

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, April 16, 2006 4:10 PM by scottgu
    Hi Ed,

    Unfortunately there isn't a way to integrate my blog directly into the VS help system.

    You can use this link: http://cookbook.scottgu.com/ though to search it.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, April 16, 2006 5:33 PM by Anonymous
    hi scott,
    i have a question...can i call/invoke .net 2.0 assembly from a .net 1.x assembly?

    thanks!
    beginner

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, April 16, 2006 5:41 PM by scottgu
    Hi Anonymous,

    You can ceretainly call a V1.1 assembly from a V2.0 one. I'm not 100% sure if you can do the reverse though -- it probably depends on the signature of the assembly (and whether you are exposing or using any new V2.0 features or APIs).

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, April 16, 2006 11:18 PM by John Bates
    Excellent; working with the original source helps a lot!

    A bug in the installer though: the .msi won't install as a non-admin. Ignores the entered path and wants to write to Program Files (and a different path to the default too!). A plain old .zip would have been sufficient.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 12:54 AM by Guest
    hi scott,
    I can't find the source code at the path after run the .msi

    so?

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 1:02 AM by scottgu
    Hi Guest,

    It is installed under the Program Files\ASP.NET Provider Toolkit directory.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 9:11 AM by Jon
    Scott,

    This is fantastic news! Thank you so much for making an effort to do this, it's definitely a step in the right direction!

    Sincerely,

    Jon

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 12:51 PM by Adam
    Why are the providers based on abstract classes, not interfaces, that seal some methods which cannot be extended? This creates major issues when creating proxy classes for some of these objects. The proxy will not be able to extend the non-virtual methods.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 1:46 PM by Sean
    When I run the installer, no actual folder/files created. Any idea?

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 3:23 PM by Brad
    This is GREAT! I'm wondering...does anyone ever post samples tbat utilize the Enterprise Library Application Blocks?

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 5:21 PM by scottgu
    Hi Sean,

    The source code is installed under your "Program Files" directory within the "ASP.NET Provider Toolkit SQL Samples" directory.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 7:41 PM by scottgu
    Hi Adam,

    The providers were abstract classes by default for versioning reasons (to help us extend in the future). If you want to send me email, I can send you a sample set of providers that implement Web Service remoting fo rthe providers for multi-tier deployment.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 9:41 PM by Miguel Madero
    Scott:

    Thanks for the code.
    We have been experimenting a lot with providers and I gotta say it's a cool design pattern.

    Adam and Scott:

    We did, just as a proof of concept, some samples of how to use the providers through WS, Remoting and MockClasses using some kind of ServiceAgent to decouple the Proxy from the provider's contract. It's something simple, but it worked, if you need the code, just e-mail me (junk@intecmex.com).

    Scott, could you post or e-mail me your sample set to compare it with what we did. Thanks.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 17, 2006 11:40 PM by Rex
    Scott, I've used the tutorials for the "Provider" tools extensively but some things are not covered or they are so loosely arranged it's hard to make sense of it for someone very new to web development (less than 6 months).

    Has someone (that you know of) put together a fully functioning example that makes use of the provider/membership/profile toolkit so that it demonstrates user managment/creation and then individual user updating like viewing their profile etc...

    When I google all results go to one other blog and then to the ASP Tutorials pages. Do you know of such a resource to assist someone like me?

    Thanks,

    Rex

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, April 18, 2006 2:02 AM by scottgu
    Hi Rex,

    Have you checked out this sample here: http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx

    It covers registering users along with using the profile system. Josh also created a cool ProfileView control that you can download here: http://flimflan.com/blog/ProfileView.aspx It provides support for easily exposing and accessing profile properties.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, April 18, 2006 2:49 AM by Paolo De Nictolis
    Hi Brad,
    not official MS stuff, but here you can find an article of mines with two examples of using Enterprise Library Blocks, for cryptography and DBSM access using stored procedures: http://www.ugidotnet.org/articles/articles_read.aspx?ID=116.
    In Italian, and free registration required.
    Me too hope and have an answer about source code of ActiveDirectoryMembershipProvider ;)

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, April 18, 2006 6:59 AM by Peter Bromberg
    Scott,
    the download that you have posted near the top of your blog post is for the Table Provider SQL Samples, not the "basically all of the built-in providers that ship in the .NET 2.0 Framework Redist" as you indicate. That is, at least at the time I downloaded it.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, April 18, 2006 10:07 AM by scottgu
    Hi Peter,

    I just double-checked, and the link at the top is actually for the SQL Providers (it installs them under the Program Files\ASP.NET Provider Toolkit SQL Samples directory.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, April 19, 2006 7:51 AM by Gary McAllister
    How comes MS didn't bother to use the Original Application Block for their data access code ?

    Surely if its good enough for us its good enough for Microsoft ??.. Plus you could cut some of that code down using the SqlHelper ?

    Might be a stupid question.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, April 19, 2006 9:31 AM by Josh Rogers
    Peter,

    These are great and I am very happy that Microsoft has done this. This is the greatest way to build a strong community of developers such as the PHP,Python,Perl, etc communities.

    As much as I like these I would also love to see some composite controls source code. I am struggling right now with composite controls. There are not near as many tutorials about them as there are about providers and I think this would be a great way to initiate those kinds of articles and get some nifty built controls from the community!

    Just an idea!
    Thanks!

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, April 19, 2006 11:52 AM by scottgu
    Hi Josh,

    We are also looking to hopefully publish the source code to some/many of our controls too in the months ahead. That is definitely also something we want to-do.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 20, 2006 8:28 AM by Chris Sully
    Re:
    You need to have the same signature for the Membership contract. But what you can do is add new methods with overloaded parameters. There is then a way to get access to them via the Membership API within an application.

    Is this via instantiating the new object directly, e.g.

    Dim bespokeMembership As New Microsoft.Samples.SqlMembershipProvider
    bespokeMembership.CreateUser(...)

    or is there a wayof doing this though the Membership API as you suggest?

    Thanks.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, April 20, 2006 5:39 PM by scottgu
    Hi Chris,

    There is a "Provider" property on the APIs like Membership, Roles and others. This gives you access to the provider instance. Its default type is the provider base class - but you can just cast this however you want to get back to your specific subclass type.

    For examoke:

    ((MyCustomMembership) Membership.Provider).CustomCreateUser(arg1);

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, April 23, 2006 3:15 AM by chenimen
    Forgive me if this is a stupid question but I'm fairly new to .net. Is there a reason why the provider source wasn't released in VB? Is C# the standard .net language now? I'm asking because most of the samples I find these days are C#.

    Cheers,

    chenimen

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, April 23, 2006 9:15 PM by tom
    thanks

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, April 24, 2006 6:35 AM by scottgu
    Hi Chenimen,

    Generally we try and ship all of our samples in both C# and VB. The reason the source code providers are C# only is because this is less of a sample, and more the real code that we ship in the product (and ASP.NET is written in C#).

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, April 25, 2006 11:37 PM by Ivan Mostacero
    thanks

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 28, 2006 5:10 AM by Marco von Frieling
    The documentation Mike requested would be very nice. The provider sources are very helpful for understanding them and implement own providers.

    But there is something missing (Membership): ValidateUser returns false if the username and / password are wrong or the user is locked. But how can I tell the Login-Controls or my ASPX containing them that the user is locked or does not exist. I need this because we will display another or additional message to the user.
    I've seen that the SqlMembershipProvider uses the WebEventBase class for this, but I cannot use it because the methods of WebBaseEvent and derived classes are internal to the framework or protected. And because all needed types (derivations of WebEventBase) exist, I would not implement additional derivations for them.

    Please can you provide some samples for this topic?

    Thanks,

    Marco

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 28, 2006 3:36 PM by yama
    Hi Scott , thnx for cool stuff here.
    I need to write a provider for membership that i must validate user both in windows and database is there any usefull toolkit?
    thanks again

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 28, 2006 8:30 PM by scottgu
    Hi Yama,

    The ActiveDirectoryProvider can be used with FormsAuthentication to authenticate users. This How-To article describes more: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000026.asp

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, April 28, 2006 8:32 PM by scottgu
    Hi Marco,

    Can you send me mail on this (scottgu@microsoft.com)? I can then loop a few folks in and we can figure out the best way to do this.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, May 02, 2006 12:29 PM by Marco von Frieling
    Hi Scott,

    I'll send you a mail about wednesday next week, because I'm learning for my exam next tuesday. I found a proprietary solution only working in overriding the OnError method of the login control. But I guess/hope there is a way not to do this.

    Marco

    # CSS Control Adapter Toolkit for ASP.NET 2.0

    Monday, May 22, 2006 3:29 AM by ScottGu's Blog
    Tired of having &amp;lt;table&amp;gt; elements rendered by the built-in ASP.NET server controls and wishing you...

    # SharePoint 2007 -- Built on ASP.NET 2.0

    Monday, May 22, 2006 3:31 AM by ScottGu's Blog
    One of the things we did with ASP.NET 2.0 was to work very closely with the SharePoint and CMS teams...

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, May 22, 2006 5:50 PM by Jeff Barclay
    Your site is fantastic,  I have been searching for a fully functionally provider to usr with an Access DB.

    I see the C# one on microsofts site, but all my code is in VB and I really would like one in VB.  I have found a few that just provide authentication and create user,  but none that have methods for all the membership controls, Like change password, get users online, change password, lookup user by email.

    Is there anything complete for use with access DB as apposed to SQLMemeberShipProvider.

    Jeff

    barclayvision@hotmail.com

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, June 09, 2006 4:32 PM by Ryan Williams
    Has anybody actually installed the source code?    Whenever I run the installer, nothing gets installed, no files are where the installer was told to put them.  Why is it in a .msi?  Can it just be zipped?

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Saturday, June 10, 2006 1:06 AM by ScottGu
    Hi Ryan,

    The source code is installed in the c:\Program Files\ASP.NET Provider Toolkit SQL Samples\ directory.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, June 11, 2006 12:52 PM by Ryan Williams
    Thanks Scott, guess I should have searched a bit more.  Why does the installer prompt for installationg location though and ignore it?  I thought I was going crazy.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 3:53 PM by David Thielen
    Hi;

    First off, thanks for releasing this. I have a couple of questions:

    1) What is the recomended way to use this if we are going to change it? I assume changing the class name and setting it as the roleManager in Web.config. If it is in a DLL in the Bin directory for my app, is that sufficient or should I do something else?

    2) Is there a sql script that will create the database? I need it for the membership & role provider. If not, is there a way to get the database created in SqlServer so we can pull everything from there?

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 4:12 PM by David Thielen
    Has anyone here ported this so it works on Oracle, DB2, & MySql?

    If not, once we get it done is there some place we could make it available in case otheres want to add more vendors?

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 7:49 PM by David Thielen
    SqlConnectionHelper has the code:
    private static object s_lock = new object();

    but s_lock is never used. Is there a reason for this or is it ok to remove?

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 7:52 PM by David Thielen
    In SqlRoleProvider there is a ton of places where it has:
    if (holder != null)
    {
    holder.Close();
    holder = null;
    }
    But holder is never referenced after it is set to null. Any idea why they did this?

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 7:53 PM by David Thielen
    Hi;

    Why wasn't SqlConnectionHolder mad IDisposable to gaurantee the Close call?

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 7:56 PM by David Thielen
    In SqlMembershipProvider in one place you have:
    catch
    {
    throw;
    }

    How is this different from not having the catch?

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 7:57 PM by ScottGu
    Hi David,

    You can find a MySQL and Oracle Provider implementation can be found here: http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 8:02 PM by ScottGu
    Hi David,

    To your question about the SQL schema -- the provider source shipped above use the same schema that the aspnet_regsql.exe utility generates.  So you can use this utility to generate your schema for you.

    To re-use the classes, I'd recommend building into a assembly .dll and just adding it to your \bin directory (or referenced from your project).  You'd then want to update your provider declarations within the web.config file to reference it.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 8:15 PM by David Thielen
    Thank you for the pointers to the Oracle & MySql providers. I was thinking we would port the SqlServer one (hence the request for the sql script, to pull that in to ErWin). But as these others exist, I think we may just use each as is.

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 12, 2006 8:19 PM by David Thielen
    Hi;

    Just to confirm, can we call all this code from a Windows app (ie an exe that runs on the server to first set everything up)? And should that work for all providers?

    thanks - dave

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, June 16, 2006 12:17 AM by ScottGu
    Hi David,

    Yep -- in theory you can also use this from a Windows app.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 26, 2006 2:34 PM by Will
    i've read the article about configuring ASP.NET 2.0 to use SQL server 2000, but i've come across a problem. Using the aspnet_regsql.exe tool failed and I get an error saying that sp_addrole needs @strUserPassword, which is not supplied. I've discovered that the problem is caused during the creation of Roles in SQL 2000. Can u provide me a solution for this?

    Thanks in Advance,

    Will

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, June 26, 2006 6:52 PM by ScottGu
    Hi Will,

    From the error message you are seeing it sounds like the user account that you are using to create the schema might not have the permissions needed inside the SQL database.

    Have you checked that that user has the appropriate SQL database permissions?

    thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, June 27, 2006 4:11 AM by joy
    hi Scott
    Now I want to add the tables in aspnetdb to my system database. can I do this? and how?

    many thanks

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, June 27, 2006 1:59 PM by Will
    Hi Scott,

    Thanks for the quick reply. Let me be more specific. With the installation of VS 2005 a database ASPNETDB has been created that DO contain the necessary roles (aspnet_Roles etc) and tables. I use windows authentication to access the SQL server and I have full access as the administrator to the SQL database. I can copy the tables and views to my Custom DB but if i try to copy all the objects including the relations etc I get the error I mentioned before. The aspnet_regsql was only able to create the aspnet_Users, aspnet_Memberships and 2 other tables. I was able to locate the problem with Roles creation because I use the DTS to copy one thing at a time (first tables, views). The exact error msg is:

    Exception:
    An error occurred during the execution of the SQL file 'InstallMembership.sql'. The SQL error number is 201 and the SqlException message is: Procedure 'sp_addrole' expects parameter '@strUserPassword', which was not supplied.
    Procedure 'sp_addrole' expects parameter '@strUserPassword', which was not supplied.
    Procedure 'sp_addrole' expects parameter '@strUserPassword', which was not supplied.

    This errormsg appears if I try to create the Roles manually.

    Thanks in advance,

    Will

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, June 28, 2006 1:21 AM by ScottGu
    Hi Will,

    From the error message above it sounds like your account might not have had full writes to run the SPROC (although I'm not sure why).

    Can you send me an email directly (scottgu@microsoft.com) with the exact error message, and then I'll loop some folks in from my team to help?

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, June 28, 2006 1:30 AM by ScottGu
    Hi Joy,

    This blog post describes how to setup the aspnetdb tables in your SQL database: http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, June 28, 2006 8:32 PM by joy

    It has been done, thank you for you help.

    :)

    and I posted another question, Did you get it?

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, July 07, 2006 2:35 AM by Keith Patton

    I'm unable to see anything after installing the msi above. Have tried on a couple of pcs, it says it's successfully installed, but nothing in the folder, have tried dropping to different folders, but no joy, very strange!

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, July 09, 2006 12:27 PM by ScottGu

    Hi Keith,

    The MSI by default installs the files here:

    C:\Program Files\Microsoft\ASP.NET Provider Toolkit SQL Samples\

    Can you check there to see if you can find them?

    Thanks,

    Scott

    # VB Version

    Wednesday, July 12, 2006 9:09 AM by Michael
    It would be really useful to have the source as vb. I am working with Web Express, and all of my classes are written in vb, therefore I cannot integrate the c# samples. Web Express says it can't compile both types.

    # Ditto: VB Version

    Monday, July 31, 2006 3:19 PM by Dan
    I too require an MS Access implentation using VB. Is there anywhere I can get more information regarding using the Built-in Security features of NET 2.0? thx, ciao, Dan

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Monday, July 31, 2006 9:31 PM by ScottGu

    Hi Dan,

    This page contains a bunch of tutorials and information on using the built-in ASP.NET 2.0 security features: http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx

    Included part way down is an Access provider for membership/roles/profiles that you can use.

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, August 30, 2006 8:40 AM by rakarish
    pl send the how to build the blocks

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, September 10, 2006 7:46 PM by robert
    Is there anyway to use membership provider in a real application using a production SQL database? All I can get working is the automatic SQL Express in the app-data folder, not a real database. And, the SQL Express breaks the first time it’s viewed with SQL express manager and never works again. Once done, I can find no configuration options, no way to fix problems, no way to move it to a production environment. After wasting hours trying to make this work, I need someone say it can even be don ein a production environment before spending more time on this.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, September 12, 2006 10:46 AM by ScottGu

    Hi Robert,

    You can definitely use the membership provider against a full SQL Server database.  The aspnet_regsql utility that comes with ASP.NET provides a GUI based interface for provisioning it.

    This post walksthrough how to-do this: http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

    Hope this helps,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Saturday, September 30, 2006 2:35 AM by Mohsen Eslamifar
    I found this link from http://forums.asp.net/thread/1232028.aspx But in this page the Membership Providers link not work. When I want to use PasswordRecovery in asp.net 2 with custom provider this errors apears: Your attempt to retrieve your password was not successful. Please try again. would you please send me a link that explain how dose I can resolve it.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Saturday, September 30, 2006 1:48 PM by ScottGu

    Hi Mohsen,

    Unfortunately some of the links on MSDN are temporarily not working.  You can find the provider download directly here: http://msdn2.microsoft.com/en-us/asp.net/aa336558.aspx

    Hope this helps,

    Scott

    # write/send/receive SMS

    Tuesday, October 10, 2006 2:36 PM by anil
    I need to write an application, which can write/send/receive SMS and edit the phonebook from a device running the Windows .Net platform. The device will be connected to any type of GSM using the serial port.

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Friday, October 13, 2006 10:48 PM by Vamsi Prattipati
    Hi Scott, Thanks for sharing your source code. Simply love the paradigm shift in Microsoft. It helps us build a better future for everyone of us and the world at large. On a different note, the ProviderToolkitSamples.msi shows the default installation directory as C:\Program Files\Microsoft\ASP.NET Provider Toolkit SQL Samples\ However, it installs to C:\Program Files\ASP.NET Provider Toolkit SQL Samples Am I missing something? Thanks -Vamsi

    # Tip/Trick: Source/Documentation for Simple ASP.NET 2.0 SQL Providers Published

    Saturday, October 14, 2006 12:37 AM by ScottGu's Blog

    One of the most popular features in ASP.NET 2.0 was the introduction of the "provider model" for the

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Saturday, October 14, 2006 10:35 AM by ScottGu

    Hi Vamsi,

    I'm actually not entirely sure why the directory names are different.  On the bright side, it looks like you still found them though <g>.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Sunday, October 15, 2006 6:25 PM by Rick Strahl
    How about the Resource Provider? That's one that's really underdocumented both with almost no examples of custom implementation nor any documentation on how the provider actually works. Aside from some incomplete articles and even book content that part is really lacking. I've been struggling with this for weeks now...

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Tuesday, October 17, 2006 11:21 AM by ScottGu

    Hi Rick,

    Eilon has a sample Custom Resource Provider here: http://www.leftslipper.com/ShowFaq.aspx?FaqId=9

    Send me mail if you are stuck with yours and I'd be happy to get a loop going with some folks who can help.

    Thanks,

    Scott

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Wednesday, October 18, 2006 8:26 AM by Zoran Spasov
    Can anyone tell me from a-z how to compile the custom SQL membership provider, and how to include in the code? And a list of the source files needed to be compiled. Thanks

    # re: Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download

    Thursday, October 19, 2006 11:50 PM by ScottGu

    Hi Zoran,

    You should be able to add the files to a class library project, and then add a reference to the System.Web.dll assembly.  You should then be able to compile and get it going.

    Hope this helps,

    Scott