• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 759
  • Last Modified:

Consistent relative path to root folders (wwwroot\webapp = 'localhost')

I wonder if i'm asking the impossible.

My local root folder is "C:\Inetpub\wwwroot\webapp" and it has an "\images" subfolder. On the remote server this folder will be www.webapp.co.uk/images so my code refers to "/images/pic.jpg". This doesn't work my IIS because it's looking for "http://localhost/images/pic.jpg" instead of http://localhost/webapp/images/pic.jpg. How can I get 'localhost' to refer to 'wwwroot\webapp'.

Many thanks

  • 2
1 Solution
Go into the IIS MMC, get the properties of the website. Navigte to the tab labelled home directory adjust the path from C:\Inetpub\wwwroot to C:\Inetpub\wwwroot\webapp

You would create a virtual directory in IIS called 'images':

Click Start, point to Programs, click to select Administrative Tools, and then click Internet Services Manager.
Expand the server name.
In the left pane, right-click Default Web Site, point to New, and then click Virtual Directory.
In the first screen of the Virtual Directory Creation Wizard, type an alias, or name, for the virtual directory (such as 'images'), and then click Next.
In the second screen, click Browse. Locate the content folder that you created to hold the images. Click Next.
In the third screen, click to select Read and Run scripts (such as ASP). Make sure that the other check boxes are cleared. Click Finish to complete the wizard.
On the Virtual Directory tab, make sure that the virtual directory name is listed in the Application Name box under Application Settings. If it is not, click Create. Note that the application name does not have to match the virtual directory alias.
Close the Properties dialog box.
RasFasAuthor Commented:
Thanx Stuart. That's done the trick. Phew! Saved me a lot of work.

RasFasAuthor Commented:

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now