Monday, March 26, 2012

PageRequestManagerServerErrorException

I have a web application built using ASP.NET Ajax 1.0. And now, I have a problem because when the IIS Server is restarted or not available the ajax engine display a message box with PageRequestManagerServerErrorException (Error 500). I would like to know if is possible treat this message and display a friendly message to user. How can I do this?I'm having the same error message pop up randomly after a page has been open for a while. I'm beginning to wonder if it is caused by Session going out of scope. With ASP.NET AJAX 1.0, do AJAX requests within an UpdatePanel moved the Session sliding expiration at all?

Hi,

This exception is thrown at the server. While in an async postback the normal exception/debug chain of the ASP.NET pipeline is ignored by default. You can either enable the normal custom error stuff in web.config by setting ScriptManager.AllowCustomErrorsRedirect on the current script manager to true, or you can handle the exception yourself at the server side by hooking to the AsyncPostBackError event on the script manager, or (if you just want to replace the message sent to the client and no more) you can set the AsyncPostBackErrorMessage.

Since async postbacks will still run through the session module at AcquireRequestState time, it seems unlikely that your sliding expiration interval is not updated. However, if you don't post back for a long period, your session will of course be abandoned. But this will not cause an exception, but rather just start a new session ...

-- Henkk


I found the problem, sorry I forgot to post it.

This error always occurred after a complete postback. I switched the postback out for an async postback, and the errors went away. Basically what was happening was that the user would sometimes be able to click on a control that would trigger an async postback before the entire page was rendered by the browser. This would break the AJAX scripts and throw that error message.

Thank you for the help with the custom errors, though!


I found what the error was. Apparently it always occurred after a regular postback so I was able to track it down. Users were sometimes able to click on a control that fired off an async postback before the entire page was able to load. This would break the AJAX scripts and throw the error.

Thanks for the help with the custom error messages!


Hello!!I have a page that has a textbox, a dropdownlist, a second textbox inside an update panel, and a second updatepanel with final textbox in it. I also have a calculate button

I am entering a number in first textbox and change selection in dropdownlist. It does an async postback with selectedIndexchanges and populates the second text box. Now when I press a calculate button the textbox in second update panel is supposed to return with values.

Both update panels are updatemode = conditional. First one is fired on selectedindexchanged of the dropdownlist and second on click of calculate button.

Everything works the first time. As soon as I calculate once, any subsequent calls to calculate or changing of the dropdown list gives the above error with server code = 500

How should I go about it?


In the calculate method, is there a control being updated that is NOT within the triggered UpdatePanel? That could be causing the issue.

No comments:

Post a Comment