Friday, April 27, 2007

How To Avoid Sys.WebForms.PageRequestManagerParserErrorException When Using The Microsoft ASP.NET AJAX UpdatePanel Control

What's a PageRequestManagerParserErrorException?

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.

As I mentioned, this is rendered out using a special format that the JavaScript on the client can understand. If you mess with the format by rendering things outside of the render phase of the page, the format will be messed up. Perhaps the most common way to do this is to call Response.Write() during Page's Load event, which is something that page developers often do for debugging purposes.


Read the rest of how to 'fix' this here: http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx

2 comments:

Anonymous said...

hello,
can you give me the reason why MS team don't resolve the problem of exception sys.WebForms.PageRequestManagerServerErrorException
rising with updatepanel in asp.net.
send us a patch or some solution :)

Parsing causes a problem and i don't imagine ajax performance in your framework without this component.
please we have a lot of project depending on this component and many poeple around the world are posting every day in forum's and no solution.

Muhammad Amir said...

facing very strange problem. I have web page [http://wms.tlpk.com/pilot].

There is a link button [Get Data] when user set criteria [To selected criteria please select customer NSN(Telenor) and leave all other as it is] and click get data. An update panel post back the page and shows the progress [Receiving Data...] and calls a very complex stored procedure which take about 3 minutes to complete and it cached the data at server in cache bag and in a temporary file. Then it alerts the user to [Refresh Grid] for latest data.

Now the problem is when query take more than 2 minute I got below mentioned message ON SOME CLIENTS [NOT ALL] exactly after 2 minutes. I have set the ServerScriptTimeout/SessionTimeout etc.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

---------------------------
Microsoft Internet Explorer
---------------------------
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12152
---------------------------
OK
---------------------------

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




Please follow the steps to produce this error [this might not appear at ur end as i m getting this error on my machine but not at my colleague's]

1) Set Criteria [Select Customer NSN Telenor, nothing else]
2) Click [Get Data] link button
3) Now wait for error or Succuss message

If you have any idea about it please respond I have spend a lot of time to fix it but ...................


--

Best Regards,
Muhammad Amir
Senior Software Engineer
Address: State Life Building, 1st Floor,
15-A, Agha Khan Road, Lahore, Pakistan
Phone no. +92-42-6303828, Ext: 115
Fax no. +92-42-6304076
Cell no. +92-333-4224416
Email: Muhammad.Amir@Mitaas.com