• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • Last Modified:

Move file to subdirectory and get error: Cannot use a leading .. to exit above the top directory

Our web site was working nicely until I moved a aspx page from the root to a subdirectory and now recieve the following error:

Cannot use a leading .. to exit above the top directory

[stack trace]
[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
   System.Web.Util.UrlPath.ReduceVirtualPath(String path) +3626102
   System.Web.Util.UrlPath.Reduce(String path) +84
   System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +326
   System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +296
   System.Web.UI.HtmlControls.HtmlLink.RenderAttributes(HtmlTextWriter writer) +112
   System.Web.UI.HtmlControls.HtmlLink.Render(HtmlTextWriter writer) +39
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
   System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +14
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
   System.Web.UI.Control.Render(HtmlTextWriter writer) +7
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
   System.Web.UI.Page.Render(HtmlTextWriter writer) +26
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558


I also created a new test.aspx in the same subdirectory and receive the same error.

I read another EE post and added the following code to the masterpage:

<base href="http://ourwebsitename.com"/>

I point to the page like so:

<asp:HyperLink ID="HyperLink2" CssClass="hoverLink" runat="server" NavigateUrl="~/Sales/accounts.aspx" Width="66px">Accounts</asp:HyperLink></td>

Help...


0
pointeman
Asked:
pointeman
1 Solution
 
Anurag ThakurTechnical ManagerCommented:
just a question are you giving the subdirectory name before accessing the page
example ~/Subdirectory/PageName.aspx

if yes then can you please show us the previous directory structure and the new directory structure and the call to the page which is throwing error
0
 
pointemanAuthor Commented:
Well, I finally just built a new Site.master page and all is well.
Thanks for our interest in my problem, but looks like I solved it...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now