How to: Create IIS Virtual Directories in Visual Web Developer

If you have Internet Information Services (IIS) running on your local computer, you can create an IIS virtual root that points to files in a location outside of the default IIS folder structure (typically \Inetpub\wwwroot). A virtual directory is useful when you want to run pages in an existing folder or in a local file-system Web site.

To create a local IIS virtual directory in Visual Web Developer

  1. In Visual Studio, on the File menu, click New and then click Web Site.

  2. In the New Web Site dialog box, click Browse.

  3. In the Choose Location dialog box, click the Local IIS icon.

    Note

    You must be a member of the Administrators group on the local computer to access the IIS metabase and create a virtual directory.

  4. In the tree control, select Default Web Site, or the folder in which you want to create a virtual directory.

  5. In the top-right corner of the Choose Location dialog box, click the Create New Virtual Directory button. (There is no text on this button, but the text appears when you place the mouse over the button.) This creates an IIsWebVirtualDirectory administration object in IIS.

    Note

    Alternatively, you can click the Create New Web Application button, which will also create a virtual directory (an IIsWebDirectory administration object in IIS), but it will not give you the option to map the virtual directory to a different physical directory. For more information, see the topic "Metabase Structure" in the IIS SDK.

  6. In the Alias name text box, type the name for your virtual directory.

  7. In the Folder text box, type the fully qualified path to the physical directory where your files are located, or click the Browse button to browse to the location, and then click OK.

    Note

    If you want clients to be able to browse to your Web pages, the access control list (ACL) configured on the physical directory needs to include Read and Execute permissions for the IIS_WPG account and the Internet Guest Account. For more information, see the topic "Access Control with IIS 6.0" in the IIS Operations Guide.

    You can continue to create or delete virtual directories in the Choose Location dialog box. When you are ready to create a Web site project, you can select the location in the tree control and click Open.

To create a remote IIS virtual directory in Visual Web Developer

  1. In Visual Studio, on the File menu, click New and then click Web Site.

  2. In the New Web Site dialog box, click Browse.

  3. In the Choose Location dialog box, click the Remote Site icon.

  4. In the Web site location text box, click New Web Site.

  5. In the Web URL text box of the Create New FrontPage Web dialog box, type the URL to the remote IIS server and append the name of the virtual directory that you want to create, for example, http://<server name>/<new virtual directory name>.

  6. Click OK.

    Note

    If an authentication dialog box opens, type your user name and password, and then click OK. You must use an account that has Create permissions on the server.

  7. In the Choose Location dialog box, click Open.

  8. In the New Web Site dialog box, click OK.

    A new Web site project is created for your new remote virtual directory. The virtual directory is created as an IIsWebDirectory administration object in the Default Web Site of the IIS server. For more information, see the topic "Metabase Structure" in the IIS SDK.

    Depending on your connection speed and processor speed, authoring a site remotely can be slower than authoring one locally. As an alternative, you can author your site locally as a test Web site and then publish or copy your test site to the remote location. For more information, see Publishing Web Sites or Copying Web Sites with the Copy Web Site Tool.

See Also

Tasks

Walkthrough: Creating a Web Site with Membership and User Login

Concepts

Types of Web Sites in Visual Web Developer

Using Visual Web Developer as a Non-Administrative User