4
votes

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.

4
@Ravi No, this is reproducible and consistent and none of those suggestions helped. - Cade Roux
Do you have clean the temporary files that asp.net creates ? at windows\microsoft.net\framework\version\temporary asp.net (to clear this the iis must be down) - Aristos
@Aristos Thanks, but that didn't help - same error in same spot (postback of some radio buttons in an updatepanel with exact same mangled response) - Cade Roux
Can you localize a problem and share an example application which able reproduce this issue? OffTop - UpdatePanels - evil, use true AJAX - sll

4 Answers

3
votes

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!

2
votes

After our talk, my idea was that maybe for some reason the cassini can not hold a big post back field, and a big one is the viewstate.

So if the viewstate is a very big one maybe this is the problem.

A second case maybe if the viewstate contain characters that some time not pass by the router or some firewall and cut them as possible attach or virus.

Possible solutions: To compress the viewstate, and/or to cut it in smaller parts.

You can also download the latest developer edition version of Cassini with lot of improvements at http://cassinidev.codeplex.com/ that maybe have fix this issue.

2
votes

Are you using some kind of http module compression? It seems to cause problems very much like yours when using updatepanels. Please review this post.

If you are not ussing compression, maybe another httpmodule related error is making you suffer. Try adding this to your webpage:

enableEventValidation="false"

Maybe you could catch the exception with this kind of code:

 protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
    {
        ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message+e.Exception.StackTrace ;
    }

<asp:ScriptManager ID="ScriptManager1" runat="server" 
            OnAsyncPostBackError="ScriptManager1_AsyncPostBackError">
</asp:ScriptManager> 

Source for that last thing.

-1
votes

Error:

Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

solution:

<add key="aspnet:MaxHttpCollectionKeys" value="100000"/ >

Add above key in app setting section.