Search code examples
iisvirtual-directory

Virtual directory and the namesake physical folder


I am using IIS10 and have a question about virtual directory.

IF
there is a virtual directory called "test", I can visit it by typing "http://localhost/test" in my browser.

However, IF
there is a physical folder also called "test" in the default folder (like "wwwroot"),I can also visit it by the same way.


When they both exist at the same time, entering "http://localhost/test" in my browser,I can only visit the virtual directory.

The question is
What is the difference between them? (I can visit them in the same way)


Solution

  • A virtual directory is nothing but, is just pointing or refers to your folder in your local machine or remote server. If you are create virtual directory under Default Web Site in IIS. Suppose if default web site got crashed due to some internal problem you cannot access your virtual directory.

    As you said both physical folder and virtual directory in the same root with same name can do the same action. but the difference is virtual directory can also map the folder where its differ from the parent folder.