Before you get started with the starter kits, you need a programming
tool to manage and develop your projects. You can use Visual Studio 2005, if that
is available, or you can use the free Visual Web Developer Express Edition
(VWDE). VWDE can be downloaded from the official ASP.NET website at http://asp.net/default.aspx?tabindex=6&tabid=46.
There are two download packages—one which includes SQL Server Express and one
that does not. Both downloads will install VWDE and the .NET 2.0 Framework.
If you do not have a version of SQL Server 2000 or 2005 installed, you will
need to install the Express edition.
For this article, I will use Visual Studio 2005 and SQL
Server 2005. The web designer component of Visual Studio is very similar to
VWDE (it is called Visual Web Developer), so there should be very few
differences. By default, the starter kits will use SQL Server 2005 Express
Edition; if you plan to deploy your website, I will show you how to reconfigure
the starter kit to use SQL Server 2005.
Installing the Club Site Starter Kit
You can add starter kits by downloading them from http://asp.net. Starter kits are downloaded as VSI
files. A VSI is like an MSI, but instead of installing a Windows component, it
installs a Visual Studio component. When prompted to Open or Save, choose to Open
the file and start the installer. If you save the file, once the download has
finished, double-click to start the installer. When the installer starts, you
will be prompted to accept a license agreement.
Figure 1: EULA for Club Site Starter Kit
We are then prompted to install the C# or VB.NET version of
the kit. Choose the version(s) you want to install and click Next.
Figure 2: Choose Which Versions to Install
To start the installation, click Finish.
Figure 3: Starting Installation
Installation will proceed; when complete, click Close. The
starter kit is now installed and is available as a template in the New Web Site
Figure 4: Installation Successful
Creating a Club Site
Now that our template is installed, we can create a new club
web site. Start Visual Studio and choose File | New Web Site. The New Web
Site dialog will open.
Figure 5: New Web Site Dialog
Choose the Club Web Site Starter Kit template and change the
name of your website. I am working with XP Pro and will use IIS for my site,
so I choose HTTP for the Location. If you are using XP Home Edition or do not
have IIS installed, you can use a file-based web site by choosing File for
Location. A file based site will use the Visual Studio built-in web server,
which for our purposes in this article is good enough. Also, choose your
language preference. One good thing about the starter kits is that you can set
up a working site in a language you are not familiar with to help you become
more familiar with that language.
When you have selected your option, choosing OK will create
and configure your new website. When complete, you will be greeted with the
Welcome page in Visual Studio.
Figure 6: The Welcome Page after Successful Installation
Once you see this page, you can load your site and use the
SQL Server Express databases. But, if you want to use a SQL Server 2000 or
2005 database, skip to the Using SQL Server 2000/2005 Databases section.
Using SQL Server Express Databases
SQL Server Express databases are stored in your project's
App_Data folder. The Club.MDF is present after installation, but the
membership database (ASPNETDB.MDF) is not yet created. The membership database
will be created when you first load your site.
Figure 7: App_Data Folder before Loading Your Site
To run the site, press Ctrl+F5. The site will compile, your
default browser will launch and load the site. If the site does not load, close
the browser and look in the taskbar down by your clock. Stop the web server
and press Ctrl+F5 again. The site should load now and you should see the
site's home page.
Figure 8: Your New Club Site
As the site loads for the first time, the membership
database (ASPNETDB.MDF) is created automatically.
Figure 9: App_Data after Your Site Loads
From this point, we are ready to add some users and begin
using our site. Skip the following section and go to the Creating Admin User
Using SQL Server 2000/2005 Databases
If you want to store user information in a database other
than the default MDF, you need to create the schema in the database before
loading your site. This is important if you plan on deploying your website to
a shared host; most hosts do not support SQL Server Express databases on their
To create the database schema in the database of your
choice, you need to use the ASPNET_REGSQL tool. You can use this as a command
line tool or use the wizard. To start the wizard, drill down to C:\Windows\Microsoft.NET\Framework\<version>
and double-click aspnet_regsql.exe. The <version> is usually v2.0.50727,
if you use ASP.NET 2.0.
When the wizard starts, you will be greeted with a welcome
page. Clicking Next will take you to the setup option page.
Figure 10: ASPNET_REGSQL Wizard
When on the Setup Option page, be sure to choose
"Configure SQL Server for application services." This will create the
membership schema (as well as roles, profiles, etc) in your database. If you
decide later that you do not want the membership information in your database,
you can come back to this page and remove the schema. Clicking Next will take
you to the server information page.
Figure 11: Make sure to choose "Configure SQL
On the server information page, you configure the server, the
database and the user credentials the installer should use. After you enter
the connection information, click Next to go to the confirmation page.
Figure 12: Server and Database Information
On the confirmation page, make sure your settings are
correct. Clicking Next will start the installation; this is the point of no
Figure 13: Confirm database settings
When installation completes, you will receive a confirmation
page. Clicking Finish will close the wizard.
Figure 14: Installation confirmation
Now that installation has completed, you can open your
database and see the membership schema has been added.
Figure 15: The Membership schema in Your Database
It is finally time to start your new club site! To start
your site for the first time, make sure you are in Visual Studio 2005 (or VWDE)
with your project open. Press Ctrl+F5 to build and start your site. After a
moment or two, your default browser should load with the home page for your new
Figure 16: Club Site Home Page
Creating Admin User
So far so good, but now what? What is the admin password?
How do we log in? At this point there are no users in the database, so there
is no way to log in. We need to create users and we can do this by using the
ASP.NET configuration tool. You can start this tool from inside Visual Studio
by navigating Website | ASP.NET Configuration. The Web Site Configuration Tool
will start in our browser. Once the tool starts, choose the Security tab.
On the security tab, we can create and manage users in our
Figure 17: Managing Website Users
On the Create User page, enter in your information and add
yourself to the Administrators role.
Figure 18: Create a New User
When you have created your user account, you will receive
the following confirmation.
Figure 19: Account Creation Confirmation
Now that you have a user account, you can now log in and
administrate your site. Other users can register using the Membership page,
but you need to use the admin tool to add users to the Administrators role.
Getting Onto a Remote Host
Localhost is fine for tinkering, but you can actually run a
website with this starter kit. What if you want to get onto a remote host?
Ideally, you will work with a host who will install the starter kit for you. Since
the files in the starter kit use inline code, rather than code-behind, you
should be able to simply upload the files to your host.
If you have a version of SQL Server that includes management
tools, you can transfer data from your local database into your remote
database. If you need to, you could also upload the schema from your local
database to the remote database, if necessary. Or, you could use aspnet_regsql.exe
and connect to your remote database to create the schema, but you will have the
issue of moving the data (you probably will not have too many users migrating
from a localhost installation).
There is a step-by-step procedure for getting your club site
online at http://www.edream.org/BlogArticle.aspx?RecordID=115.
Changing the Site Design
The design and layout of pages in the Club Site Starter Kit
is controlled by Master Pages, a technology introduced in ASP.NET 2.0. You can
find an introduction to Master Pages at http://asp.net/QuickStart/aspnet/doc/masterpages/default.aspx.
To add a new Master Page to your site, right-click on your
project and choose Add New Item. When the Add New Item window appears, choose
Master Page and give your Master Page a name.
Figure 20: Adding a Master Page
The most important feature of a Master Page is the
ContentPlaceHolder. This tells the .NET Framework where to place the
information from your Content Page. Design issues are beyond the scope of this
article, but we can work through a quick example.
In the Source view of your new Master Page, change Listing 1
to Listing 2.
Now, change Listing 3 into Listing 4 and view Default.aspx
to see our gorgeous layout.
<%@ Page Language="VB"MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"Title="Untitled Page" %>
Figure 21: New Master Page Design
That is all there is to creating a new design for your
website. If you are handy with CSS and some simple image editing, you are not
too far from a completely new design.
The Club Site Starter Kit is only one of several free kits
that can be used for learning ASP.NET 2.0, as well as serving as a foundation
for a production website. Getting the Club Site kit installed and running is
pretty easy, but if you want to use a database other than the default SQL
Server 2005 Express databases, the steps are not so clear. Likewise, creating
Administrators is not so clear. This article showed how to install the starter
kit, as well as use a different database and create Administrators.