Cloned Virtual Machine on Domain

August 18th, 2006 Comments

One thing I figured while cloning a VHD is that when you start the cloned VM for the first time, make sure that you do not log on to the domain. Logon to the local machine first and run NEWSID to rename the computer and assign it a new SID. Failure to do so creates multiple entries in the Active Directory with the same NETBIOS name, and you may not be able to logon to the domain from the original VPC. If that occurs, however, the remedy is to remove both machines from the domain, and then join the domain again one machine at a time (i.e. after renaming the second machine and assigning it a new SID).

Securing ASP.NET 2.0 Apps Using Membership and Role Providers

August 17th, 2006 Comments

I recently designed an intranet application using ASP.NET 2.0 and really loved the membership and role providers that tremendously simplifified our implementation of security features in the application. Membership and role information can be stored in a SQL Server database or another repository such as Active Directory. For our intranet application it made sense to use Active Directory as the membership provider and SQL Server as the role provider.

Configuring Role and Membership Providers:

Essentially everything is configured declaritively using Web.config:

In the above configuration file, note that we first specify our connection strings starting at line 2. LocalSqlServer points to a SQL Server database which has been configured using aspnet_regsql. The second connection string points to the domain controller for membership authentication.

In the authentication section we specify that we are using forms authentication, and provide the URL for our logon page.

In the roleManager section we configure our role provider, pointing back to LocalSqlServer as the role repository.

In the membership section we configure our membership provider pointing back to ADConnectionString (domain controller) specified in the connectionStrings section.

Finally we restrict users from accessing certain folders based on their roles using location sections (role-based security).