Creating an IIS Virtual Directory


As mentioned earlier, the ReadMe file accompanying this book's sample files provides the instructions to install the samples for this book. However, you might also want to create your own ASP.NET Web application so that you can develop .aspx pages to test any controls that you implement. If you are using the standalone .NET Framework SDK, you will have to create an IIS virtual root, which maps the physical directory containing your Web application to an IIS virtual directory. (If you are using Visual Studio .NET, you do not need to do this because the ASP.NET Web application wizard creates a virtual root for you.)

We will assume that you have created a directory (such as C:\MySample ­Web) that will contain pages and other elements of your ASP.NET Web application. We will also assume that you have installed IIS and the .NET Framework SDK on your computer. The following list shows how to create an IIS virtual directory that maps to the physical directory of your Web application:

  1. If you are using Windows XP, from the Start menu select Control Panel, then select Performance And Maintenance, Administrative Tools, and finally Internet Information Services. If you are using Windows 2000, from the Start menu select Applications, then select Administrative Tools, and finally Internet Services Manager.

  2. Expand the local computer node and then the Web Sites node.

  3. Right-click the Default Web Sites node to bring up a drop-down menu. Select New Virtual Directory from the menu choices. This will launch the Virtual Directory Creation Wizard, which will walk you through the steps for creating a virtual directory.

  4. In the Virtual Directory Alias page, enter a name such as MySample ­Web in the Alias text box. You can enter any name you want for your Web application, as long as it does not conflict with an existing IIS virtual directory. Click Next to access the next page of the wizard.

  5. In the Web Site Content Directory page, enter the path to the physical directory for your Web application in the Directory text box ”for example, enter C:\MySampleWeb . You can also enter the path by browsing to the directory for your Web application. Click Next.

  6. In the Access Permissions page, you can accept the defaults or modify the permissions as needed. Click Next.

  7. Click Finish on the final page of the wizard to complete the creation of the virtual directory.

If you named your Web application MySampleWeb and it contains a page named MyPage.aspx, you can test whether the IIS virtual directory was successfully created by entering http://localhost/MySampleWeb/MyPage.aspx in the address bar of your Web browser.

You should also create a bin subdirectory to place assemblies that your Web application requires, such as the assembly that contains your controls. To create the bin directory of your application, you must create a directory named bin within the root of your Web application ”for example, C:\MySampleWeb\bin. Chapter 5, "Developing a Simple Custom Control," describes the purpose of the bin directory in more detail.



Developing Microsoft ASP. NET Server Controls and Components
Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)
ISBN: 0735615829
EAN: 2147483647
Year: 2005
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net