Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a multi-tennant website that I'm migrating from IIS5 on Win 2000 to IIS7 on Win Server 2008 64bit.

Every tennant has their own domain name that they point to the application server's IP address.

Then we set up a site in IIS for each domain name and set the physical path to the path where our (classic) ASP files are located.

For each site, I want to set up a default document that runs an ASP file and passes the CompanyID in the querystring.

E.g. would call Connect.asp?CompanyID=425 would call Connect.asp?CompanyID=426

To achieve this on IIS7, I have a web.config file in the root physical path of the ASP files which looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<location path="">
            <add value="Connect.asp?CompanyID=425" />
<!-- a location entry for every other website here... -->
<location path=".">
            <add value="Connect.asp?CompanyID=1" />

This is not working - all the sites are going to the CompanyID=1 entry.

Can someone point out what I'm doing wrong?

I've tried setting the path attribute to

  1. the domain name
  2. the friendly name of the site in IIS

either way it doesn't work.

share|improve this question
up vote 1 down vote accepted

I found the solution at this link on the iis forums

You can put the configuration in location tags in applicationhost.config rather than in web.config file - by doing something like this from the command line:

%windir%\system32\inetsrv\appcmd.exe set config "MySite1" -section:system.webServer/defaultDocument -+files.[value='newdoc.aspx'] -commitpath:apphost

  • MySite1 is the friendly name of the site in IIS (the site name you see in the tree on the left)
  • newdoc.aspx is the name of your default document for that site (you can specify a querystring)

So for the example that I posted above, I ran this command for each of my sites

%windir%\system32\inetsrv\appcmd.exe set config "MySite1 -" -section:system.webServer/defaultDocument -+files.[value='Connect.asp?CompanyID=425'] -commitpath:apphost


%windir%\system32\inetsrv\appcmd.exe set config "MySite2 -" -section:system.webServer/defaultDocument -+files.[value='Connect.asp?CompanyID=426'] -commitpath:apphost

When you go to the default document program for the 2 sites in the IIS7 management program, you will see the different default documents set for the 2 sites.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.