1.
Go back to the ASP.NET support site and follow the Download the .NET
Framework link again.
2.
This time, click the appropriate download link under the .NET Framework
Version 2.0 Software Development Kit heading. The link will advance you to a
download page.
3. Choose the language version of the installation you want to use and click
Download, as you did to download the redistributable package.
4. When prompted to do so, save the file to a local directory.
5. After the download is complete, double-click the executable to begin the in-
stallation. Before you do so, I strongly recommend that you close all other
programs to ensure the install proceeds smoothly.
6. Follow the steps outlined by the .NET Setup Wizard until installation com-
pletes. When asked for setup options, its safe to use the default values.
The SDK will take slightly longer to install than the framework.
A Big Download!
The .NET Framework SDK weighs in at about 350MB, so it will probably
take a while to download.
Configuring the Web Server
Configuring IIS
After installing the .NET Framework and the SDK manually, you will need to
configure IIS to make it aware of ASP.NET. To do this, you need to follow a few
simple steps:
1.
Open the command prompt by selecting Start > All Programs > Microsoft .NET
Frameworks SDK v2.0 > SDK Command Prompt.
2. Type the following command to install ASP.NET:
C:\Program Files\\SDK\v2.0>aspnet_regiis.exe -i
Start installing ASP.NET (2.0.50727).
.........
Finished installing ASP.NET (2.0.50727).
11
Configuring the Web Server
3. Once ASP.NET is installed, close the command prompt and check again to
confirm that ASP.NET installed correctly.
Running aspnet_regiis.exe
Depending on the circumstances, ASP.NET may already have been installed
for you, but running aspnet_regiis.exe cant hurt. Also, remember that
you need to run this utility again in case you reinstall IIS.
Configuring Cassini
If youve installed Cassini, youll need to get under the hood of the .NET
Framework to coerce Cassini into working as it should.
1.
Open the command prompt by selecting Start > All Programs > Microsoft
.NET Frameworks SDK v2.0 > SDK Command Prompt.
2. Enter the following command at the prompt:
C:\Program Files\\SDK\v2.0>gacutil /i C:\Cassini\Cassini.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 2.0
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly successfully added to the cache
Cassini is now ready to go.
Where do I Put my Files?
IIS Recommended
From here on in, the instructions we provide will be centered around IIS, as
Cassini isnt suitable for production environments. Many of the concepts
well discuss do not apply to Cassini, as its much simpler and lacks many
of IISs features. Where needed, Cassini instructions will be given, but IIS
will receive the bulk of the discussion.
Now that you have ASP.NET up and running, lets find out where the files for
your web applications are kept on the computer. You can readily set IIS to look
for web applications in any folder, including the My Documents folder, or even a
network share. By default, IIS maps the C:\Inetpub\wwwroot folder of your disk
to your web sites root directory, which is generally considered a good repository
for storing and managing your web applications.
12
Chapter 1: Introducing ASP.NET and the .NET Platform
If you open this wwwroot folder in Windows Explorer, and compare its contents
with the files that appear in the Default Web Site in the IIS administration tool,
as shown in Figure 1.5, youll notice that the files and folders are the same (some
extra items will be listed in IIS; well look at these shortly). You need to use the
IIS administration tool to set up the behavior of these files and folders under IIS.
Well see more on this soon.
Figure 1.5. Folders inside wwwroot also appear inside IIS
Using localhost
By putting your files within C:\Inetpub\wwwroot, you give your web server access
to them. If youve been developing web pages for a long time, habit may drive
you to open files directly in your browser by double-clicking on the HTML files.
However, because ASP.NET is a server-side language, your web server needs to
have a crack at the file before its sent to your browser for display. If the server
doesnt get this opportunity, the ASP.NET code wont be converted into HTML
that your browser can understand. For this reason, ASP.NET files cant be opened
directly from the disk using Windows Explorer.
Your local web server can be accessed through a special web address that indicates
the current computer: http://localhost/. If you try this now, IIS will open up a
default help page (although this behavior will vary depending on the settings of
13
Configuring the Web Server

Get Build Your Own ASP.NET 2.0 Web Site Using C# & VB, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.