【问题标题】:How to fix Error executing child request?如何解决执行子请求时出错?
【发布时间】:2014-04-11 12:41:13
【问题描述】:

我正在构建一个 asp.net 应用程序,但在尝试传输页面时不断收到此错误:

执行 Edit_PropertyData.aspx 的子请求时出错

我不知道是什么原因造成的,也不知道如何解决,任何帮助将不胜感激!

这里是Edit_PropertyData.aspxPage_Load事件

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    cmdChangeMaterial.Attributes.Add("onclick", "CheckSaveStatus();")
    cmdEditMaterial.Attributes.Add("onclick", "CheckSaveStatus();")

    If Session("Mode") Is "Edit" Then
        cmdEditMaterial.Enabled = True
        cmdSaveData.Enabled = True
    Else
        cmdEditMaterial.Enabled = False
        cmdSaveData.Enabled = False
    End If

    pnlMain.Visible = True
    pnlMain.Height = Unit.Pixel(650)

End Sub

【问题讨论】:

  • 分享你的Edit_PropertyData.aspx代码
  • @ClarkKent 只是 Page_Load 事件?
  • Server.Transfer 非常有限。你为什么需要它?不会,例如HttpContext.Current.RewritePath 工作得更好?或者您应该使用更好的方法?
  • @Luaan 嗯,我会试试HttpContext.Current.RewritePath我以前从来没有用过这个
  • 更重要的是,你为什么要做Server.Transfer?你想做什么?

标签: asp.net vb.net


【解决方案1】:

Server.Transfer 不允许你做很多事情。您可能正在尝试使用它来传递查询字符串参数等。但是您不需要那个 - URL 不会在传输目标中更改,因此您仍然拥有原始查询字符串。这可能是好事也可能是坏事,取决于你如何使用它:)

您可能想改用其他传输方法 - 如果您在 HttpModule 内,请查看 HttpContext.Current.RewritePath

【讨论】:

  • 我尝试了HttpContext.Current.RewritePath 并出现了另一个错误。我只是想这样做,所以当用户点击一个按钮时,会出现一个不同的网页
  • @bbesase 这就是Response.Redirect 的用途:) 或者如果您需要该操作以转到其他页面,请使用PostBackUrl 或更改表单操作。
【解决方案2】:

到目前为止,您尝试过什么?快速搜索会提供许多类似的错误消息以及建议和接受的解决方案。

Server.Transfer throws Error executing child request. How to resolve?

http://forums.asp.net/t/1489436.aspx?Server+Transfer+Error+executing+child+request

http://support.microsoft.com/kb/320439

你没有提到你从哪里转移,但我怀疑 Response.RedirectHttpContext.Current.RewritePath 对你来说会是更好的选择。

【讨论】:

    猜你喜欢
    • 2011-01-22
    • 2010-11-25
    • 1970-01-01
    • 1970-01-01
    • 2019-06-14
    • 1970-01-01
    • 2019-07-04
    • 1970-01-01
    相关资源
    最近更新 更多