Learn how to a build a cloud-first strategyRegister Now


Cannot use a leading .. to exit above the top directory - HttpException (0x80004005)

Posted on 2007-10-17
Medium Priority
Last Modified: 2010-06-24
Hello experts!
I have an asp.net project for which I created 2 different virtual directories at IIS. One is used by the debug version of the project and other is used by the production version of the project.
The problem is that I'm getting an error when "navigating" thru the physical directories of each project.
On the debug version I'm using (..) to navigate to the previous directory, but I can't use (~) to proceed.
On the production version I'm using (~) to navigate to the previous directory, but I can't use (..).
Is it something I need to configure at IIS?

This is the error message:

[HttpException (0x80004005): Can't use .. on the left to go to the superior directory.]   System.Web.Util.UrlPath.ReduceVirtualPath(String path) +3644954   System.Web.Util.UrlPath.Reduce
(String path) +84   System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +355   System.Web.Configuration.AuthenticationConfig.GetCompleteLoginUrl(HttpContext context, String loginUrl) +211
   System.Web.Configuration.AuthenticationConfig.AccessingLoginPage(HttpContext context, String loginUrl) +48   System.Web.Security.FormsAuthenticationModule.OnEnter(Object source, EventArgs eventArgs) +167  
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Question by:andrepires
  • 3
  • 2
LVL 96

Accepted Solution

Bob Learned earned 1000 total points
ID: 20096699
'~' is the root marker, not the previous page marker.  Why can't you use it in both production and development environments?

LVL 16

Assisted Solution

McExp earned 1000 total points
ID: 20096702
the ~ character on IIS and the VS Dev server will give you the root of the application, are you trying to link to files outside of the application root by using ..?

Author Comment

ID: 20096834
I'm just trying to link to some files that are inside of some different directories of my application, but all directories are inside the root directory.
I'm not talking about pages here, but directories.
So, suppose I have the following directory structure:
Now suppose that I want to link to a file that is located at the root dir and that I'm currently inside MySubFolder2.
On the production app I can use ~ to go directly to the root directory, but cannot use ../../MyFile.xml to refer to the file on the root dir.
On the debug version I can use ../../MyFile.xml to refer to the file on the root dir, but cannot use ~
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 16

Expert Comment

ID: 20096874
ok, that is odd, how are you running the debug version?

Author Comment

ID: 20096936
I'm using VS to run the project.
LVL 16

Expert Comment

ID: 20097011
I have run the following code from a [webroot]\NewFolder1\NewFolder2 from both VS and IIS all seams fine: -

    <asp:HyperLink ID= "HyperLink2" runat="server" NavigateUrl="~/XMLFile.xml">with Tilda</asp:HyperLink>
    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="../../XMLFile.xml">with Dots</asp:HyperLink>

Does your code differ from the above?

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question