restrict access to IIS virtual directory from root website

Posted by Senthil on Server Fault See other posts from Server Fault or by Senthil
Published on 2010-05-17T19:15:59Z Indexed on 2011/11/29 1:53 UTC
Read the original article Hit count: 567

Filed under:
|

I have two domains (domain1.com and domain2.com). Both of them use the same Windows hosting server with IIS7.

One of the domains is being called the "primary domain" by my hosting provider (GoDaddy) and it always points to the root folder that I was given.

For the other domain, I have created a virtual directory in IIS and pointed it there.

The folder structure is like this -

root/
--Default.aspx
--SomeFile.aspx
--domain2folder/
----Default.aspx
----Domain2SomeFile.aspx

So, if I type domain1.com, I see the regulakr Default.aspx. But if I type domain2.com, I am shown the contents of domain2folder as if it were a separate web application - I think that is what IIS virtual directory is meant for. Well and good.

But the problem is, when I type http://domain1.com/domain2folder, I see the domain2's website!

But I don't want that to be shown when I use the path like that from domain1. Only if they use domain2.com, user should be able to see those contents. How can I do that? Hope I am making sense.

Thanks.

© Server Fault or respective owner

Related posts about iis7

Related posts about virtual-directory