Search code examples
asp.netiis-7url-rewritingwindows-server-2008virtual-directory

Create ASP.Net Application in Subdirectory or URL Rewriting?


I have an ASP.Net 4.0 web application running on:

www.foo.com

The client has asked that the application be moved to:

www.foo.com/bar

Right now I do not have access to the DNS Records to setup a sub domain. Should I do this with URL Rewriting or should I use a Virtual Directory? How do I set the subdirectory bar as the application root?

What are the best practices here?

UPDATE I have created a virtual directory but get this error when I browse to it

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

UPDATE See my answer below


Solution

  • Well after a fun hour or so scouring the interwebs here's how I got it to work:

    1. Open IIS Manager.
    2. Right click on site and select "Remove".
    3. Right click on Default Web Site and select "Add Application".
    4. Set the Virtual Path "bar" and add the proper Physical Path.