Getting your website up on a web host

The most common problem for the novice Starter Kit user is moving their site from their personal computer to their web host.

A common stumbling block is the database configuration. When you run the StarterKit on your personal computer a database file is created in the App_Data folder of your site and everything works fine. When you move the site to your web host this database will not work for you. You are going to have to copy the information from the database on your personal computer and replicate it to your Web hosts SQL Server Database either through a backup and restore proceedure (which is the way I like to do it) or through running a script against the hosted database. Check out the steps below for the details.

I am assuming you have your site up and running just fine on your local machine and here are the steps to move to a hosted environment.

Basic Steps:

1) Get a web hosting account. You already have one you say? Great, but all web hosts are not created equal. Not to knock anyone in particular too much but some of the large (and inexpensive) web hosts (godaddy, 1and1, etc.) make it a challenging to get your starter kit to work. In particular, some starter kits such as CSK and Club Starter Kit 2.0 among others require that you have a full trust rather than a medium or partial trust environment on your Web host. This is not going to be something that you can change – either your host provides it or they do not. There are several hosts that specialize in .NET hosting (such as, among many more) and they will make your life much easier when you want to go live with your web site. It is up to you but you may be able to save yourself a lot of time and anguish by researching which web hosts work well with your particular Starter Kit. In addition, many of the hosts that specialize in .NET hosting have an option in their control panel where they will automatically install a blank Starter Kit into your hosted space. Now this is not going to help you if you have already customized your Starter Kit locally but if you are just now getting started there is no easier way to get live on the Internet.

2) Create a blank SQL 2005 database on your Web Host. The exact steps to do this are going to vary by Web Host by will be accomplished from your online control panel. Be sure to write down the name of the database you created.

3) Create a user for that database on your Web Host. Again the exact steps are going to vary but it will be accomplished through your control panel and you will need to write down the user name and password you created.

4) Created a backup of your local Starter Kit’s Database. This should be located in the App_Data folder of you Starter Kit and will be a .mdf file. I recommend using SQL Server Management Studio Express to do the backup (it can be downloaded for free here: If you have not done so already from SQL Server Management Studio you will need to “attach” the database that you would like to back up. This is done from the main screen in SQL Server Management Studio, just right click on the databases folder and select “attach” then browse to the file location of your database. Once the database is attached right click on it and select “backup.” This will create the .bak file that you need to replicate your local database onto the Web Host.

5) Restore the local backup to your Web Host. Depending on your Web Host you either need to upload the .bak file to your hosted space and then do the restore or you can do the restore directly from the local copy of the .bak file you created. This will be accomplished through your control panel and there is usually a “maintenance tools” option for your SQL database where you can select “restore.” If all goes well your local database is now replaced onto your host.

6) Modify your connection string in your web.config file to point to the online SQL database you created. When you initially install your Starter Kit the connection string section of your web.config file will look something close to this:
<add name=”LocalSqlServer” connectionString=”Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf” />
You need to modify this to point to the SQL database on the Web Host. It should take the form of:
<remove name=”LocalSqlServer”/>
<add name=”LocalSqlServer” connectionString=”Data;Database=xxxxx;User Id=xxxxxx;Password=xxxxxxx;TrustedConnection=False” providerName=”System.Data.SqlClient”/>
The specifics that you enter here will be the info that you wrote down from steps 2&3 above and the “Data Source” info will come from your Web Host.

7) Upload you web site. Using either Visual Web Developer or your favorite FTP client, upload your website files to your Web Host.

8) You are done!