开发者

Global.asax breaks with AJAX Control Toolkit

开发者 https://www.devze.com 2023-02-06 10:18 出处:网络
Everything was working fine. Then I added the Global.asax and suddenly got this error: Line: 4723 Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server co

Everything was working fine. Then I added the Global.asax and suddenly got this error:

Line: 4723 Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near '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 Sessio开发者_如何学编程n_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


Try commenting out this line and see if that fixes it.

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

HTH.


This is not elegant, but it works for my needs (thankfully this is an internal app). It's a two-part solution. One is for the postbacks that occur due to an UpdatePanel postback. The other is for regular postback.

Global.asax breaks with AJAX Control Toolkit

Global.asax breaks with AJAX Control Toolkit

I'd rather not close this thread, because I think better solutions can be presented.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号