Javascript – ASP.NET Ajax Error: Sys.WebForms.PageRequestManagerParserErrorException

ajax.netasp.netexception handlingjavascriptnet

My website has been giving me intermittent errors when trying to perform any Ajax activities. The message I get is

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 '

<!DOCTYPE html P'.

So its obviously some sort of server timeout or the server's just returning back mangled garbage. This generally, unfortunately not always, happe

Best Answer

There is an excellent blog entry by Eilon Lipton. It contains of lot of tips on how to avoid this error:

Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoid it

Read the comments too. There is a comment of somebody with the same problem: "I solved it changing server idle time of my app pool on IIS. It was only 5, so I incremented it and now works."

"The UpdatePanel control uses asynchronous postbacks to control which parts of the page get rendered. It does this using a whole bunch of JavaScript on the client and a whole bunch of C# on the server.

Asynchronous postbacks are exactly the same as regular postbacks except for one important thing: the rendering. Asynchronous postbacks go through the same life cycles events as regular pages (this is a question I get asked often).

Only at the render phase do things get different. We capture the rendering of only the UpdatePanels that we care about and send it down to the client using a special format. In addition, we send out some other pieces of information, such as the page title, hidden form values, the form action URL, and lists of scripts."

Most common reasons for that error:

  1. Calls to Response.Write():
  2. Response filters
  3. HttpModules
  4. Server trace is enabled
  5. Calls to Server.Transfer()
Related Topic