« Previous Next »

Thread: IIS not retaining virtual root directory...?

Last post 07-24-2008 5:33 PM by tomkmvp. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 07-23-2008, 1:38 PM

    IIS not retaining virtual root directory...?

    Hi guys,

    I setup an application pool and a virtual directory for an asp.net web application that I setup.  I am able to navigate fine to "default.aspx" ( http://localhost/MyWebApp/ ) however when I try to click through a link, instead of keeping the "MyWebApp" part ( for example: http://localhost/MyWebApp/List/List.aspx ) "MyWebApp" is removed and it acts like http://localhost is the root directory. 

    Any thoughts on why it might be doing this?  I am using all relative directories in my application ( example ~/list/list.aspx )

    Thank you!

  • 07-24-2008, 4:03 PM In reply to

    Re: IIS not retaining virtual root directory...?

    Relative directories resolve from the web site root, so you need:

    ~/MyWebApp/list/list.aspx

    Check www.asp.net (same login as here) for help on getting around this.

    Jeff

    Look for Wrox's new book Professional IIS 7 in your local bookstore, or order now at Amazon.com
  • 07-24-2008, 5:28 PM In reply to

    Re: IIS not retaining virtual root directory...?

    Isn't creating a virtual directory in IIS the same thing as creating a root directory?  I am confused as to why this would matter...?  What should I be doing differently in IIS because I can navigate just fine through the site in visual studios built in browser.
  • 07-24-2008, 5:33 PM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 6:27 AM
    • Central NJ
    • Posts 6,174

    Re: IIS not retaining virtual root directory...?

    No.

    A virtual directory is a web folder mapped to a physical location that is outside the physical server root path.  For example, if you have content at D:\files and your web site root is at C:\inetpub\wwwroot, you could create a virtual directory named "files" and map it to D:\files which would then allow you to browse to http://yourserver/files, even though C:\inetpub\wwwroot\files doesn't actually exist.

    When you say a root directory, I think you mean a directory set as an application - thereby making it the root folder of your application scope.  IIRC, ASP.NET uses "~" to refer to your application root.

    How are you constructing the links that are not behaving as expected?

Page 1 of 1 (4 items)
Microsoft Communities