Windows – Application under a site in IIS evaluates ~ to the website root not the virtual directory

asp.netiis-7windows

I have a website in IIS lets call it QA.local. Under this root site I want to set up multiple applications that reside in a set of virtual directories E.G. QA.local/app1 and QA.local/app2. The problem is that whenever an application goes to resolve the ~ symbol the server returns the website root rather than the directory which hosts application so QA.local/page.aspx instead of the correct path QA.local/app1/page.aspx. Am I missing something basic in the config here or what?

Best Answer

You need to use 'Applications' rather than 'Virtual Directories' for your asp.net sites.

In IIS Manager you can right click your virtual directory and 'Convert to Application'.

Virtual Directories are just pointers to other locations within the same application, in this case the root application.

Applications are their own unit of execution, or app domains in dot.NET, to use the tilde (~) and other features of ASP.net you need to use an application.