-------------------
Virtual Directories
-------------------

In order to use these code examples, you can simply copy the .aspx and .vb files to any virtual directory on your computer, and then request them through your Internet browser (as in http://localhost/MyDirectory/MyFile.aspx). This process is well-documented in the book.


----------------------------------------
Using the Examples in Visual Studio .NET
----------------------------------------

If you want to use the Visual Studio .NET project files that are included with the examples, you will have to use the *exact same* directory structure and drive as I do. You will also need to convert all the project directories into matching virtual directories.

To create the correct directory structure, extract this zip file to drive C:\. You should have the following directories:

C:\ASP.NET\Chapter05*
C:\ASP.NET\Chapter06*
C:\ASP.NET\Chapter07
C:\ASP.NET\Chapter09
C:\ASP.NET\Chapter10
C:\ASP.NET\Chapter11
C:\ASP.NET\Chapter12
C:\ASP.NET\Chapter13
C:\ASP.NET\Chapter14
C:\ASP.NET\Chapter15
C:\ASP.NET\Chapter16
C:\ASP.NET\Chapter17
C:\ASP.NET\Chapter19
C:\ASP.NET\Chapter20
C:\ASP.NET\Chapter21
C:\ASP.NET\Chapter22
C:\ASP.NET\Chapter23
C:\ASP.NET\Chapter24
C:\ASP.NET\Chapter25
C:\ASP.NET\TestWeb*
* These are the only directories that do *not* have Visual Studio .NET project and solution files.

Every chapter directory contains one or more project directories (for example, C:\ASP.NET\Chapter06\CurrencyConverter is a project directory). Every one of these project directories must be changed to a corresponding virtual directory. For example, C:\ASP.NET\Chapter06\CurrencyConverter should be mapped to http:\\localhost\ASP.NET\Chapter06\CurrencyConverter. Note that the virtual directory path and then physical directory path are the same. This is required because Visual Studio .NET stores the virtual directory name for each project in a .vbproj.webinfo file.

A quick and easy way to do this is to turn ASP.NET into a virtual directory (named ASP.NET) using the IIS wizard. Then, go through all the project sub-directories, and make each one into a web application by right-clicking, choosing properties, and then pressing the Create button. When you are finished, right-click on the root ASP.NET virtual directory, select properties, and then click Remove to turn it back to an ordinary directory. The IIS_Config.jpg file in this directory shows how some of the IIS configuration should look when you are finished.

You might think that you can simply make the root directory (ASP.NET) into a virtual directory, and save a little effort. Unfortunately, this is not the case. The problem is two-fold:
* Some of the projects (like those about security) use their own web.config application settings, and you can't set those more than once in the same application.
* Visual Studio .NET is unable to run a web project unless it is configured as a web application. In other words, you would be able to load the project and solution files, but you can't to debug them unless they are in a valid web application directory.

An alternative option is just to import the .aspx and .vb files you want into your own Visual Studio .NET projects.


---------------------------------------
Running the Pages in Visual Studio .NET
---------------------------------------

Finally, note that every web project is made up of several example pages, which do not always relate directly. To run a page from Visual Studio .NET, right click on it and set it to be the startup page. Then start the application. You can also start the application, and then type different .aspx file names into the browser.


-----------------------------------
SQL Server and Data Access Examples
-----------------------------------

You may need to modify some of the database samples before they work with your RDBMS.

1. If you are using SQL Server on the local computer, make sure the service is started (or is set to start automatically). You can check to make sure it is running by loading Enterprise Manager and requesting a database.

2. If don't have the Northwind and pubs databases, you can use the included T-SQL scripts to install the northwind and pubs databases (by running the northwind.sql and pubs.sql files in a utility like Query Analyzer). These scripts do not add any of the content, however, so you will have to generate some information to use them successfully. Use the adboard.sql file to create the database structure needed for the ad board example in Chapter 21. If you have SQL Server, you can run these scripts using the Query Analyzer utility.

3. You may need to tweak the database connection string for your settings. This is the most common setting for SQL Server 2000 (it uses Windows integrated security):

Dim Connect As String = "Data Source=localhost;Integrated Security=SSPI;" & _
    "Initial Catalog=Northwind;"

If you aren't using integrated security, you will have to replace this with a connection string like this for the sa account (although it can vary depending on your database and whether you have configured a special password):

Dim Connect As String = "Data Source=localhost;user id=sa;" & _
    "Initial Catalog=Northwind;"

The sample examples in Chapter 13 include a ConnectionTester.aspx page that lets you try both ways to connect.



--------------------
Web Service Projects
--------------------

The \ASP.NET\Chapter19\WebServices directory contains the sample Web Services. The \ASP.NET\Chapter20\WebClients contains client pages that use these Web Services. Additionally, you can use the \ASP.NET\Chapter20\WebClients\WebClients.sln solution file to load both the Web Services and the clients and the same time.


-----------------
Security Settings
-----------------

For the WindowsSecurity project in Chapter 24, you will need to modify the IIS settings for the virtual directory to force Windows authentication, as described in the book.


---------------
Custom Controls
---------------

If you want the custom controls developed in Chapter 23 to be shown on your Toolbox, you will need to add them as described in the book. Visual Studio .NET stores global preference information for the Toolbox--it is not stored in individual projects or solutions.
