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

Hello experts!
I have an 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
Who is Participating?
Bob LearnedConnect With a Mentor Commented:
'~' is the root marker, not the previous page marker.  Why can't you use it in both production and development environments?

McExpConnect With a Mentor Commented:
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 ..?
andrepiresAuthor Commented:
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 ~
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

ok, that is odd, how are you running the debug version?
andrepiresAuthor Commented:
I'm using VS to run the project.
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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.