Migration of Database Users using Auth0 and Kentico 12 MVC | Part 2 - ASP.NET 2.0 Membership

Behind the Curtain - ASP.NET 2.0 Membership


In part 1 of our series, I showed what you can expect from the rest of this series. If you remember, we had a user named Jane that we migrated from an ASP.NET 2.0 Membership database into Auth0 and also into Kentico. While you now know the end result, let’s understand each of the moving parts, starting with the ASP.NET 2.0 Membership database.

ASP.NET 2.0 Membership

Do you remember this guy from the early 2000s? If not, don’t worry too much about it as it is not something that many people use any longer, thus the reason I was looking for a solution on migrating away from this database in the first place. If you are really feeling nostalgic, and you want to learn much more about this than what I am going to get into, the old 4 Guys from Rolla have a great tutorial explaining everything. Man, I learned so much from them back in the day. 

Since this is an older way of doing things, getting a database setup in the first place was quite a challenge. With Visual Studio 2010, you could add this right from the Solution Explorer, however, Microsoft has since removed this from Visual Studio. Now, the only way we can get this database to be created is by using Command Prompt with the following command:

You will be prompted with a wizard to setup the initial database. I set up my database on Azure as you have to open quite a few firewall ports for scripts to work correctly on Auth0 (which we will touch on in part 3 of this series). In order to do this, however, you will need to setup the database locally using this wizard and then it can be restored on Azure as Azure does not support the scripts in this application that are used to create this database. 

Once the database has been created, it will look like the following...

Here is where it gets a little tricky. Since we no longer have the admin tool built right into Visual Studio, we need to determine a different way to display this tool so we can fill our database with users and roles. I performed the following steps to get my administration tool to be displayed…

Step 1: Setup a new Web Site Application that uses ASP.Net Membership. This is necessary for the ASP.Net Web Site Administration Tool to run correctly.
  • Create an ASP.NET Empty Web Site (it is important that this is a website and not a web application) ​
  • Modify the web.config file to contain the following:
    • Connection to the ASP.Net 2.0 Membership Database that will be used. I pointed my connection to the Azure instance of my database.  
    • Add configurations for Membership, Profile, and RoleManger providers
Step 2: make sure C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files has full access by EVERYONE

NOTE: Keep in mind that full access by everyone is never a great practice, but when working on a development machine, this is okay.

Step 3: In a Command Prompt, change the directory to C:\Program  Files\IIS Express

Step 4: Type the following in Command Prompt: iisexpress.exe /path:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ASP.NETWebAdminFiles" /vpath:"/ASP.NETWebAdminFiles" /port:51111 /clr:4.0 /ntlm

NOTE: Port 51111 was used for my setup, but this port can be any that you like. 

Step 5: Browse to the following location: http://localhost:51111/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=[path of the application created in Step 1]&applicationUrl=/


There we have it, the creation of the ASP.NET 2.0 Membership Database. From here, you can create new roles and users that you want to try and migrate. 

NOTE: While an ASP.NET 2.0 Membership database might be exactly what you are looking for, this entire process is not dependant on this part whatsoever. Any database could be used and the process of migrating users would work just about the same. In other words, what you see here has no real bearing on the final result, but it was a problem that I took entirely too much time on trying to solve, so I am passing along my knowledge to you. 

In part 3 of this series, I will walk you through the complete setup of Auth0, including the scripts used to migrate our newly created user and their roles into an Auth0 database. 
Click here to read more Kentico posts
Start a Project with Us
Photo of the author, Darian Bonnell

About the author

An outgoing and energetic individual, Darian has been working in the tech industry for over 20 years. In that time, he has worn many hats including quality assurance, development, sales, and architecture. While his goal is to continually make his job enjoyable for the clients and co-workers he works with, Darian knows when and how to get the important tasks completed to move projects forward. When not working, Darian loves going on dates with his wife and playing with his three, young daughters.

View other posts by Darian

Subscribe to Updates

Stay up to date on what BizStream is doing and keep in the loop on the latest with Kentico.