【问题标题】:Global.asax breaks with AJAX Control ToolkitGlobal.asax 打破了 AJAX 控制工具包
【发布时间】:2011-01-25 13:57:29
【问题描述】:

一切正常。然后我添加了Global.asax,突然出现这个错误:

线路:4723 错误:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器接收到的消息。此错误的常见原因是通过调用 Response.Write()、响应过滤器、HttpModules 或启用了服务器跟踪来修改响应。 详细信息:在 'eeCtrl_Data = null;| 附近解析错误

<%@ Application Language="VB" %>

<script runat="server">

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs on application startup
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs on application shutdown
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when an unhandled error occurs
End Sub



Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when a new session is started
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when a session ends. 
    ' Note: The Session_End event is raised only when the sessionstate mode
    ' is set to InProc in the Web.config file. If session mode is set to StateServer 
    ' or SQLServer, the event is not raised.
End Sub

Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
    HttpContext.Current.Items("renderStartTime") = DateTime.Now
End Sub


Protected Sub Application_EndRequest(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim startTime As DateTime = CType(HttpContext.Current.Items("renderStartTime"), DateTime)
    Dim renderTime As TimeSpan = DateTime.Now - startTime
    HttpContext.Current.Response.Write("<!-- Render Time (in milliseconds): " & renderTime.TotalMilliseconds.ToString & " -->")
End Sub

【问题讨论】:

    标签: asp.net asp.net-ajax ajaxcontroltoolkit global-asax


    【解决方案1】:

    尝试注释掉这一行,看看是否能解决问题。

    HttpContext.Current.Response.Write("<!-- Render Time (in milliseconds): " & renderTime.TotalMilliseconds.ToString & " -->")
    

    HTH。

    【讨论】:

      【解决方案2】:

      这并不优雅,但可以满足我的需求(谢天谢地,这是一个内部应用程序)。这是一个两部分的解决方案。一种是由于 UpdatePanel 回发而发生的回发。另一个用于定期回发。

      我宁愿不关闭这个帖子,因为我认为可以提出更好的解决方案。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-02-22
        • 2013-05-22
        • 1970-01-01
        • 2011-06-19
        • 2010-11-22
        • 2011-01-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多