Today I will explain how to create a virtual directory for ASP.NET . You can use IIS Manager to create a virtual directory for an ASP.NET Web application that is hosted in IIS 6, and IIS 7.5. IIS 8 A virtual directory appears to browsers as if it were contained in a Web server’s root directory, even though it can physically reside somewhere else. This approach enables you to publish Web content that is not located under the root folder of a Web server, such as content that is located on a remote computer. It is also a convenient way to set up a site for local Web development work, because it does not require a unique Web site for each virtual directory. This topic explains how you can create a virtual directory and configure it to run ASP.NET pages.
You must create a virtual directory as part of an existing IIS Website. This can be either the default Web site that is created when IIS is installed, or a Website that you have created. As an alternative to creating a virtual directory for a Web application, you can create a new Website
Create a virtual directory by using IIS Manager
- In IIS Manager, expand the local computer and the Website to which you want to add a virtual directory.
- Right-click the site or folder in which you want to create the virtual directory, click New, and then click Virtual Directory.
- In the Virtual Directory Creation Wizard, click Next.
- In the Alias box, type a name for the virtual directory and then click Next. Choose a short name that is easy to type, because users type this name to access the Web site.
- In the Path box, type or browse to the physical directory that contains the virtual directory, and then click Next.
- You can select an existing folder or create a new one to contain the content for the virtual directory.
- Select the check boxes for the access permissions that you want to assign to the users.
By default, the Read and Run Scripts check boxes are selected. These permissions enable you to run ASP.NET pages for many common scenarios.
- Click Next and then click Finish.
Configuring the Virtual Directory
After creating a new virtual directory, you can configure security and authentication for the virtual directory. When you configure security, you specify permissions for an account or group. The following table shows the permissions settings that are available in IIS 6, IIS 7.5, and IIS 8.
Account or Group
|An account or group that is allowed to browse the site if you disabled anonymous authentication when you created the virtual directory.||Read & Execute|
|The account that is configured to access system resources for the ASP.NET current user context, such as the Network Service account (IIS 6.0) or the ASPNET account (IIS 7.5 and 8).||Read & Execute
List Folder Contents Read Write
Configure security and authentication for a virtual directory
- In IIS Manager, right-click node for the virtual directory that you want to configure, and then click Properties.
- Click the Directory Security tab, and then in the Authentication and access control section, click Edit.
- Select the check box for the authentication method or methods that you want to use for your virtual directory, and then click OK. By default, the Enable anonymous access and Windows Integrated Authentication check boxes are already selected.
The two most common authentication scenarios are as follows:
- Windows Integrated authentication for a local intranet site.
- Forms authentication for an Internet or extranet site where users access the site through a firewall.
- To configure authentication for an Internet site, you must configure forms authentication.
- To configure authentication for an intranet or local development scenario, clear the Enable Anonymous access check box, and make sure that the Integrated Windows authentication check box is selected.
- In Windows Explorer, open the parent folder of the folder that will contain the pages for the site. Right-click the folder and then click Sharing and Security.
- The Properties dialog box for the folder is displayed.
- Click the Security tab.
- In the Group or user names list, select a group or user name.
In the Permissions list, select appropriate permissions for the group or user name.
- Click Apply.
- Click OK.