`Cannot use a leading .. to exit above the top directory.`
`[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
System.Web.Util.UrlPath.ReduceVirtualPath(String path) +9985452
System.Web.Util.UrlPath.Reduce(String path) +50
System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +217
System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +266
System.Web.UI.HtmlControls.HtmlLink.RenderAttributes(HtmlTextWriter writer) +74
System.Web.UI.HtmlControls.HtmlLink.Render(HtmlTextWriter writer) +41
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +21
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +13
System.Web.UI.Control.Render(HtmlTextWriter writer) +12
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +13
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1303
`
My project was working fine and now i do not know what happen, every time i navigate it gives me the error.
I tried using the full link
1. <a class="nav-link" href=" http://localhost:64406/Test/Product.aspx">Add Products</a>
<a class="nav-link" href="../../Test/Product.aspx">Add Products</a>
<a class="nav-link" href="../Test/Product.aspx">Add Products</a>
<a class="nav-link" href="~/Test/Product.aspx">Add Products</a>
<a class="nav-link" href="Test/Product.aspx">Add Products</a>
Nothing works.
I searched everywhere to try and find the solution but nothing solved my problem. also visited this link Cannot use a leading ../ to exit above the top directory but it could not solve my problem.
This will help everyone who struggled to get the solution for this problem, I solved this problem by replacing all the links <a class="nav-link" href="../Test/Product.aspx">Add Products</a>
WITH <a class="nav-link" href="/Test/Product.aspx">Add Products</a>
This includ all the CSS and Js links <link rel="stylesheet" href="/css/style.css"/>
Don't just replace 1 link, replace all the links in your MasterPage.
User contributions licensed under CC BY-SA 3.0