Global.asax 与 AJAX 控制工具包中断
一切都工作正常。然后我添加了 Global.asax 并突然出现此错误:
线路:4723 错误:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器接收的消息。出现此错误的常见原因是通过调用 Response.Write()、响应筛选器、HttpModule 或启用服务器跟踪来修改响应。 详细信息:在 '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
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 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试注释掉这一行,看看是否可以解决问题。
HTH。
Try commenting out this line and see if that fixes it.
HTH.
这并不优雅,但它可以满足我的需求(谢天谢地,这是一个内部应用程序)。这是一个由两部分组成的解决方案。一种是由于 UpdatePanel 回发而发生的回发。另一个用于定期回发。
我不想关闭这个线程,因为我认为可以提出更好的解决方案。
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.
I'd rather not close this thread, because I think better solutions can be presented.