Getting Started with the Club Site Starter Kit
page 1 of 1
Published: 25 May 2006
Unedited - Community Contributed
Abstract
Since the release of ASP.NET 2.0, several starter kits have been released as examples of programming practices. These kits are also good starting points for actual websites and can be valuable to novice webmasters. This article will demonstrate how to download and install the Club Site Starter Kit, configure a different database to prepare for a production site and change the appearance by modifying the master page.
by Richard Dudley
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 41922/ 23

Introduction

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 dialog.

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 section.

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 web servers.

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 Server..."

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 return.

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 site.

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 website.

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.

Listing 1

<body>
<form id="form1"runat="server">
<div>
<asp:contentplaceholderid="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>

Listing 2

<body>
<form id="form1"runat="server">
<div>
<table><tr><tdcolspan=2><h1>Caddyshack</h1></td></tr>
<tr><tdstyle="background-color:Red; width:200px;"></td><tdstyle="background-color:Blue;">
<asp:contentplaceholderid="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</td></tr></table>
</div>
</form>
</body>

Now, change Listing 3 into Listing 4 and view Default.aspx to see our gorgeous layout.

Listing 3

<%@ Page Language="VB"MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>

Listing 4

<%@ 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.

Summary

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.



User Comments

Title: trouble when running ASP.NET conf tools   
Name: Fred
Date: 2010-02-17 9:12:37 AM
Comment:
as I try to use the ASPNET config tools I get the messages:
Erreur du serveur dans l'application '/ClubWebSite1'.
--------------------------------------------------------------------------------

L'indicateur d'ouverture de session d'instance utilisateur n'est pas pris en charge dans cette version de SQL Server. Fermeture de la connexion.
Description : Une exception non gérée s'est produite au moment de l'exécution de la demande Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code.

Erreur lors de la création automatique du fichier de base de données SQLExpress:


La chaîne de connexion utilise un emplacement de base de données dans le répertoire App_Data des applications pour spécifier une instance SQL Server Express locale. Ayant déterminé qu'elle n'existait pas, le fournisseur a tenté de créer automatiquement la base de données des services d'application. Les conditions de configuration requises suivantes sont nécessaires pour vérifier correctement l'existence de la base de données des services d'application et créer automatiquement cette base de données :


Si le répertoire des applications App_Data n'existe pas déjà, le compte de serveur Web doit bénéficier de droits d'accès en lecture et en écriture au répertoire des applications. Cette condition est nécessaire puisque le compte de serveur Web créera automatiquement le répertoire App_Data s'il n'existe pas déjà.
Si le répertoire App_Data des applications existe déjà, le compte de serveur Web a seulement besoin d'un accès en lecture et en écriture à ce répertoire. Cette condition est nécessaire puisque le compte de serveur Web tente de vérifier si la base de données SQL Server Express existe déjà dans le répertoire App_Data des applications. Si l'accès en lecture au répertoire App_Data du compte de serveur Web est supprimé, le fournisseur ne pourra pas correctement déterminer si la base de données SQL Server Express existe déjà. Toute t
Title: Good article   
Name: MJoy
Date: 2010-02-13 8:32:08 PM
Comment:
Thank you for such a detailed article regarding this set up. The biggest issue I had was the changing of the web.config connection and then the sql scripts I needed to manually run since I used SQL 2000. Your article helped tremendously though!
Title: MS_ACCESS   
Name: Daniel
Date: 2007-01-12 1:29:51 AM
Comment:
Is there an option to MS-Access as the database instead of MS-SQL or MySQL? If so, please let me know how to convert the site and database to MS-Access.
Thanks (dafepi2004@yahoo.es)
Title: Need help with Guest Role   
Name: Jessie Chen
Date: 2006-12-28 10:19:45 AM
Comment:
I have trouble with users who are in the Guest Role. I want the Guest user be able to view the private photos when logged in.

I have tried modifying the web.config file but the Guest users still can't see the private photos.

How do you manage or administer the Guest Role and control the access of the content?

I would appreciate any help.

Thanks!

JC
Title: MS-Access   
Name: Richard Dudlet
Date: 2006-11-21 10:51:32 PM
Comment:
You would need to write a custom provider to use MS-Access. It's a daunting task, but copying or modifying the SQL Server provider would be a good start.
Title: MS-Access DSN-Less Option?   
Name: Andrew
Date: 2006-11-15 10:35:58 PM
Comment:
Is there an option to MS-Access as the database instead of MS-SQL or MySQL? If so, please let me know how to convert the site and database to MS-Access.
Thanks (garciaa7@comcast.net)
Title: Error   
Name: Amir
Date: 2006-06-07 2:24:40 AM
Comment:
Yes.
I install final visual Studio 2005.
Title: Visual Studio   
Name: Jonas
Date: 2006-06-04 4:34:04 AM
Comment:
Do u have Visual Studio 2005 installed? I think u need that to run VSI setup files...

/ j
Title: Error   
Name: Amir
Date: 2006-06-02 5:48:11 PM
Comment:
I can't run "vsi" files.
I get the error:
.... .vsi is not a valid Win32 application.

could you please help me ?
Title: Correction to Listing 4   
Name: Richard Dudley
Date: 2006-05-24 11:18:23 AM
Comment:
The new MasterPage filename in Figure 20 should be "caddychack.master", and Listing 4 should read:
<%@ Page Language="VB" MasterPageFile="~/caddyshack.master" Title="Untitled Page" %>

Sorry about that!

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2017 ASPAlliance.com  |  Page Processed at 2017-01-21 10:35:35 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search