ASP.NET - How to fix..PageRequestManagerServerErrorException

Asked By anbu n on 02-May-11 07:03 AM
Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500


-----------------------
The above error occurs very rarely ... if this error occurs ... is this error caused by update panel or stored proc or ?
Ravi S replied to anbu n on 02-May-11 07:07 AM
HI

This is a known bug you may have caused it or maybe you did not check below for how to fix it.  If you still need help post again so I can provide more info.
Jitendra Faye replied to anbu n on 02-May-11 07:16 AM

Also try this to avoid a PageRequestManagerParserErrorException-

To start with, don't do anything from the preceding list! Here's a matching list of how to avoid a given error (when possible):

  1. Calls to Response.Write():
    Place an <asp:Label> or similar control on your page and set its Text property. The added benefit is that your pages will be valid HTML. When using Response.Write() you typically end up with pages that contain invalid markup.
  2. Response filters:
    The fix might just be to not use the filter. They're not used very often anyway. If possible, filter things at the control level and not at the response level.
  3. HttpModules:
    Same as response filters.
  4. Server trace is enabled:
    Use some other form of tracing, such as writing to a log file, the Windows event log, or a custom mechanism.
  5. Calls to Server.Transfer():
    I'm not really sure why people use Server.Transfer() at all. Perhaps it's a legacy thing from Classic ASP. I'd suggest using Response.Redirect() with query string parameters or cross-page posting.

Another way to avoid the parse error is to do a regular postback instead of an asynchronous postback. For example, if you have a button that absolutely must do a Server.Transfer(), make it do regular postbacks. There are a number of ways of doing this:

  1. The easiest is to simply place the button outside of any UpdatePanels. Unfortunately the layout of your page might not allow for this.
  2. Add a PostBackTrigger to your UpdatePanel that points at the button. This works great if the button is declared statically through markup on the page.
  3. Call ScriptManager.RegisterPostBackControl() and pass in the button in question. This is the best solution for controls that are added dynamically, such as those inside a repeating template.

for more detail follow this link-
http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx

Reena Jain replied to anbu n on 02-May-11 07:28 AM
hi,

Error 500 is a generic catch-all server error . You can examine your server log files to find out the exact cause of the error.  This is a server error so it really can't be prevented in your code, but it can be handled. 
here are two good link on this

http://www.asp.net/AJAX/Documentation/Live/ClientReference/Sys.WebForms/Exceptions/PageRequestManagerServerErrorException.aspx
http://bloggingabout.net/blogs/rick/archive/2008/02/20/pagerequestmanagerservererrorexception-status-code-500.aspx

hope this will help you
Mihir Soni replied to anbu n on 02-May-11 10:07 AM
Hello,



spend your time looking at page validation. Get this dev tool for browser from below link: 

http://projects.nikhilk.net/WebDevHelper/

which will help you to get your issue

  • Load it and then catch the response from the server, then enable logging.
  • When you request the page you'll see it in the URL list.
  • Then choose Response text and change the dropdown from partial rendering to text. That will give the full error