C# – UpdatePanel Postback Error: Sys.WebForms.PageRequestManagerParserErrorException

ajaxasp.netcnetvisual studio 2010

Already looked at this:
Sys.WebForms.PageRequestManagerParserErrorException – what it is and how to avoid it

Problem is that it's only happening on my dev box. Two other developers are fine.

It's consistent and reproducible – I've tried deleting temporary internet files, deleted my obj and bin files and rebooting.

The response is clearly truncated when I look at it in the debugger when it hits the error.

Where else do I need to check to clear/clean out?

The error I'm seeing in the code is:

Microsoft JScript runtime 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 ' </tr>
'.

_endPostBack: function PageRequestManager$_endPostBack(error, executor, data) {
    if (this._request === executor.get_webRequest()) {
        this._processingRequest = false;
        this._additionalInput = null;
        this._request = null;
    }

    var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
    Sys.Observer.raiseEvent(this, "endRequest", eventArgs);
    if (error && !eventArgs.get_errorHandled()) {
        throw error; // THIS IS WHERE THE ERROR IS THROWN
    }
},

This is during an Ajax postback.

  1. There are no Response.Write calls.

  2. I'm using Cassini/VS 2010 Development Server, how do I tell if there are filters?

  3. ditto

  4. Server trace is not enabled

  5. No calls to Server.Transfer

In firebug, I can see that the response to the POST is truncated. Problem happens in Firefox or IE, and whether I'm debugging in VS or not.

The problem does go away if I switch to IIS Express in Visual Studio, and then it returns when I am back on the ASP.NET Development Server.

Best Answer

I have seen this problem before with Cassini. I solved it by adding the following to the Web.config:

<system.web>
  <httpModules>
    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  </httpModules>
</system.web>

The entry above is for version 1.0. Make sure that the Version and PublickKeyToken attributes match the ASP.net Ajax version that you are using. Also you may want to disable event validation in your page:

enableEventValidation="false"

Hope it helps!

Related Topic