The AspNetLoginControl
Example B-3 shows the definition of AspNetLoginControl.
Example B-3. The AspNetLoginControl class
public partial class AspNetLoginControl : LoginControl
{
protected override IUserManager GetUserManager()
{
return new AspNetUserManager();
}
}
AspNetLoginControl derives from LoginControl, and in its overriding of GetUserManager() it returns the AspNetUserManager implementation of IUserManager, which uses the ASP.NET providers directly (see Figure B-4).
AspNetUserManager is capable of using any valid ASP.NET 2.0 provider (hence its name). To use AspNetLoginControl, you will need to add to the application’s configuration file the same values you would have placed in a web application configuration file, indicating which provider to choose as well as any provider-specific values and settings.
For example, to use the SQL Server provider (which is the default provider), add the settings shown in Example B-4 to the application configuration file. The connection string value shown in Figure B-4 is used to connect to the aspnetdb database on the local machine after default installation. Note the use of the enabled attribute of the roleManager tag to enable authorization.

Figure B-4. The AspNetLoginControl control
Example B-4. Settings for AspNetLoginControl
<?xml version="1.0"?> <configuration> <system.web> <roleManager enabled="true"/> </system.web> <connectionStrings> <remove ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access