Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Imagine the folllowing directory structure:


As far as I know, in order to make this work I'd need to set up four separate websites in IIS. What I'd really like to do is for dave and alan to have FTP access into their c:\websites\users\dave\ and c:\websites\users\alan\ directories and then be able to create brand new websites by just creating a new directory and pointing the domain at the right IP address, without us needing to add a new website in IIS.

Is this even possible?

share|improve this question
up vote 0 down vote accepted

You can't do it without creating an additional site. Without either a different IP binding or host header, IIS has no way of knowing what content to serve.

You could, however, set up some sort of script at the root of the site to redirect to the proper content by anaylzing the incoming request's host header. For example, you'd point all the sites to the same IP, then redirect.aspx/php/py/whatever looks at the host header, and redirects to correct content.

share|improve this answer

without us needing to add a new website in IIS.

Impossible. IIS needs to know how to route requests. Rights need to be set up. But mostly - you need IIS configuration.

share|improve this answer
Disappointing. You can do this in Apache can't you? – user57850 Oct 21 '10 at 17:53
what rights? That's irrelevant because dave and alan will both have their own FTP accounts. And IIS could have some means of routing based on directory names, or some web.config based solution even? Something that allows the main server admin to avoid getting involved. – user57850 Oct 21 '10 at 18:04
Then you do not like security at all. I secure every website with their own running user, iloated to read only on that directory path. – TomTom Oct 21 '10 at 21:24

As others have said and I'll repeat, you can't do it without creating an additional site.

However, you can fake it, especially if they keep to the naming convention you list above. What you do is create a scheduled task that checks the sub-levels of those user directories. When it finds a dirname that looks right, it then runs some commands that create the site for you. Create the script in PowerShell which gives you vastly better string handling semantics and error checking than simple batch-files. Run it every 15 minutes or something.

Some key commands:

Adding a site:

appcmd add site /name:"" /bindings: /physicalPath:"c:\websites\users\dave\"

Removing a site:

appcmd delete site ""

Seeing if a site already exists:

appcmd list site ""

The 'appcmd' utiltiy is located in C:\Windows\System32\Inetsrv\. The site created with the above command will use a host-header to determine which site the server will serve.

share|improve this answer

This is on the right track. setup your sites within that directory path and then create IIS sites for each directory which will serve the sites document root.

Create ftp, setup each ftp site with a corresponding document root to match the site in which they should have access. Protect the other document roots ftp by modifying the NTFS permissions, set the ACLs using Allow or Deny. Set deny rules for the users whom should not be able to read and or write to those directions.

share|improve this answer
I don't think this addresses the question though: how would each newly created directory get served up by IIS? – user57850 Oct 21 '10 at 17:52

You could have one IIS site, with multiple host name headers. Then have a default document of, say, index.aspx. The code within could then detect the URL that you've specified and go to, for example, ./dave/

share|improve this answer

Your Answer


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