WHY NOT USE THE ASP.NET 2.0 CONTROLS?
The built-in ASP.NET 2.0 controls are fine for public facing pages that allow your customers to login and create their own account and change passwords, etc. This application does not do that. It allows you as an Administrator of the site, to manage (or create) users and roles. This is something that the public should not be able to do and this application extends the capabilities a bit more to help admins manage their sites.
I've found that when I build a web site application for a client, it will always have an Admin site to manage the site. Generally I also need to manage the Users and Roles for the site.
First, there is no built-in interface to manage Roles, so you have to build one. Second, I've found that I don't have complete control over the User and Role management the way I need it and this also makes it easier for my clients who will end up managing the application themselves. I don't like to use the ASP.NET Configuration Tool in Visual Studio 2005, especially since my client will not have access to it.
So this is a pretty comprehensive Membership system that allows you to manage users and roles for a system.
QUICK TEST RUN
To quickly see how this application works, after you unzip the file, simply open the application in Visual Studio 2005 and make appropriate modifications to the web.config file to point to the Membership and Roles providers you are working with. (See below for more web.config settings)
After the web.config is pointing to you Membership and Roles providers, simply run the application.
INSTALLATION INTO YOUR DEVELOPMENT APPLICATION
Unzip the zip file to a directory of your choice. It should NOT be unzipped into the ASP.NET application you will be using it in. You'll see why later. For now, just unzip it somewhere that will allow you to copy the files to any application you want.
First off, again, this application was built to be used in an Admin site to a public facing site. It is not intended to be used for public membership creation and/or management. The standard ASP.NET 2.0 controls are good for that.
To install this into an application that you are working on, simply copy the files into their respective folders.
Example:
\App_Code\HyperLinkPager.cs
\Controls\CreateUsersControl.ascx
\Controls\ManageRolesControl.ascx
\Controls\ManageUsersControl.ascx
\Admin\CreateUser.aspx
\Admin\Default.aspx
\Admin\ManageRoles.aspx
\Admin\ManageUsers.aspx
\[Your folder of choice]\MembershipStyles.css
\Web.sitemap
\web.config
WEB.CONFIG MODIFICATIONS
This example is using a custom Membership and Role providers (MyMembershipProvider, MySqlRoleProvider). It's completely up to you on what attributes you place in the Membership provider. You can use these or change them as you deem fit.
<system.web>
<rolemanager enabled="true" defaultprovider="MySqlRoleProvider">
<providers>
<add name="MySqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionstringname="LocalSqlServer"
applicationname="MyApp" />
</providers>
</rolemanager>
<membership defaultprovider="MyMembershipProvider">
<providers>
<clear />
<add name="MyMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionstringname="MyConnection"
applicationname="MyApp"
requiresquestionandanswer="false"
requiresuniqueemail="true"
minrequirednonalphanumericcharacters="0"
minrequiredpasswordlength="5" />
</providers>
</membership>
</system.web>
CONNECTION STRINGS
In my example I have installed the ASP.NET membership database objects in the same SQL Server database as the application I'm working on, not in the default ASPNETDB.mdf. I did this for more control. You don't have to do this, you can use the automatic ASPNETDB database, you'll need to remove the LocalSqlServer element in the Connection String element.
If you end up moving the ASPNETDB files into your own database, you'll need to include the Clear element and re-add the LocalSqlServer connection for the ASPNET files.
<connectionstrings>
<clear />
<add name="MyConnection"
connectionstring="Data Source=(local);
Database=MyDatabase;
User ID=myUser;
Password=12345;"
providername="System.Data.SqlClient" />
<add name="LocalSqlServer" connectionstring="Data Source=(local);
Database=MyDatabase;
User ID=myUser;
Password=12345;"
providername="System.Data.SqlClient" />
</connectionstrings>
That's it!
You are free to enhance or change this any way that you need.
If you have any questions or problems, you can post them in my Forum.
You can download the Membership API application from the Downloads page.
Here are some screen shots of the Membership API that I've integrated into a clients project I'm currently building.



