ASP.NET Ajax Error: Sys.WebForms.PageRequestManagerParserErrorException
I had this happen to me and none of the causes on the list in the answer applied. I didn't find the root of the problem until I disabled my AJAX altogether. Discovered that the code was saving an object to the ViewState that contained an unserializable object. I made the object serializable and it started working again.
I solved this exact same problem removing the Content-Type:
form the Custom HTTP Headers
section in the HTTP Headers
tab in IIS
. This was breaking the encoding of the page and somehow it affected Ajax in general.
The Content-Type
I had configured in IIS
was setting the encoding to ISO-8859-1
.
Probably there is an error occuring on post back. In this case, you can view the details about the error by adding a PostBackTrigger to your updatepanel and referencing the button which causes the problem:
<asp:updatepanel ID="updatepanel1" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="button1" />
</Triggers>
<ContentTemplate>
</ContentTemplate>
</asp:updatepanel>
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:
- Calls to Response.Write():
- Response filters
- HttpModules
- Server trace is enabled
- Calls to Server.Transfer()