gpt4 book ai didi

c# - 调试 ASP.NET 无法使用前导 .. 退出顶级目录

转载 作者:行者123 更新时间:2023-11-30 17:59:27 25 4
gpt4 key购买 nike

我遇到了可怕的 Cannot use a leading .. to exit above the top directory.

不幸的是,它是在……某处生成的?……超出了我的控制范围。是否有工具可以帮助我找出它的生成位置?甚至超链接的实际文本?也许 intellitrace 不知何故?

是的,有一百万个谷歌搜索结果。我知道我需要修复什么,我只是不知道问题实际发生在哪里。

我尝试覆盖渲染事件,然后在我可以通过从基础遍历控件树找到的每个 HtmlLink 对象上调用 ResolveClientURL,但这绝不会引发异常或做任何错误。它会不会只在 base.render 期间死掉,因为我从 /v5/plugins/dashboard 中的页面调用 ResolveClientURL 并且基页位于 /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

最佳答案

从母版页和错误页中删除 ../并放置 ~/更正错误-不能使用前导..退出顶级目录。

关于c# - 调试 ASP.NET 无法使用前导 .. 退出顶级目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11217053/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com