我越来越害怕了Cannot use a leading .. to exit above the top directory.
对我来说不幸的是它正在生成......在某个地方?....超出我的控制。是否有工具可以帮助我找出它是在哪里生成的?甚至是超链接的实际文本?也许以某种方式进行智能跟踪?
是的,有一百万个谷歌搜索结果。我知道我需要解决什么,我只是不知道问题实际发生在哪里。
我尝试覆盖渲染事件,然后在每个 HtmlLink 对象上调用 ResolveClientURL,方法是从基础遍历控制树,但这永远不会引发异常或做错任何事情。它会不会base.render
因为我从一个页面调用 ResolveClientURL/v5/plugins/dashboard
而基础页面在/v5/
?
这是我为手动调试而写的。我希望这段代码会引发异常。
protected override void Render(HtmlTextWriter writer)
{
foreach (Control c in base.Controls)
{
Trace.Write("New base control");
var baseParent = c;// findBaseParent(c);
Trace.Write(baseParent.GetType().ToString());
renderChillunsRecursive(baseParent, 0);
}
base.Render(writer);
}
private int total;
private void renderChillunsRecursive(Control c,int depth)
{
var chilluns = c.Controls;
foreach (Control a in chilluns)
{
renderChillunsRecursive(a,depth +1);
total++;
}
string otherString = String.Empty;
if(c.GetType() == typeof(HtmlLink))
{
HtmlLink theLInk = ((HtmlLink) c);
otherString = theLInk.Href;
otherString += " - " + theLInk.ResolveClientUrl(theLInk.Href);
}
Trace.Write(String.Format("{0} - {1} - {2} - {3} - {4}",depth,total,c.GetType(),c.ToString(),otherString));
}
堆栈跟踪
[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
System.Web.Util.UrlPath.ReduceVirtualPath(String path) +8886247
System.Web.Util.UrlPath.Reduce(String path) +52
System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +214
System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +180
System.Web.UI.HtmlControls.HtmlLink.RenderAttributes(HtmlTextWriter writer) +74
System.Web.UI.HtmlControls.HtmlLink.Render(HtmlTextWriter writer) +42
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8703574
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +17
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8703574
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8703574
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
FileBasePage.Render(HtmlTextWriter writer) +2331
FileDetails.Render(HtmlTextWriter writer) in c:\inetpub\V5 - Development\Plugins\Dashboard\FileDetails.aspx.cs:690
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8703574
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266