ASP.NET Ajax Control Toolkit - capturing unhandled exceptions? - asp.net

I inherited an ASP.NET (.NET 4.7.2) application. It has Elastic rigged-up (via the Javascript API) to capture APM data and errors from the front-end.
The top offending errors in Elastic for months now have been:
Uncaught Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out.
Uncaught Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404 (but sometimes it will say 503).
Both refer to ScriptResource.axd as being the "culprit".
On the one hand, it sure would be nice if I could find out exactly WHAT resource or URL was being requested... as well as which page in my app is doing the requesting.... when such an error occurs.
But I'm at the point now where... as an alternative, I'd just be happy to change these from being unhandled exceptions to handled ones. (I don't think our users are actually having any serious issues from these. The major page for this app is one that updates a couple of key update panels once every 8 seconds. So, occasional failures of those requests are somewhat expected. Users would have already raised hell if something major was going on.)
I'd much rather see any errors in Elastic that are coming from our own Javascript code than from the Ajax Control Toolkit.
So, does anyone know how I might capture these?

I THINK I've finally found the right information (though some of these pages are from 2008). How to basically add a custom error handler to the Script Manager:
Script Manager 4.5 handling errors
https://social.msdn.microsoft.com/Forums/en-US/59a34e36-f80b-4344-a793-8ea2ce21abe2/ajax-exception-handling?forum=aspdotnetajax
Handle Asynch error messages with ScriptManager
https://blog.digitaltools.com/post/2010/02/03/Unhide-Exceptions-Hidden-By-AJAX.aspx
Looks like I should be able to either bury the exceptions... or get more details on them and pass them on through to get thrown to Elastic.
I think my biggest hurdle right now would be to actually try to recreate these errors myself (preferably in a non-prod environment). But I guess I'll figure that out somehow.
Thanks!

Related

Any way to handle Ajax Errors globally on asp net webforms?

I am looking for a way to log ajax errors globally. I have already read numerous ways but none of them worked. The problem is that when an error occured in ajax requests it gets handled by the RestHandler.ExecuteWebServiceCall and never triggers Application_Error.
It is well described here by #Michael Liu .
The problem with his answer is that there is no way to get the actual exception and log it if you have customErrors option set to On in webconfig.
Note that i don't want to return stack traces to javascript or anything like that. Also the app is very old and big and i am not able to change the entire system of how soap or ajax or logging works as it would be a high risk of breaking the app.
Is there any way to catch and log these exceptions globally?
Thanks in advance.

ASP Classic 500 Error, ASP_CLIENT_DISCONNECTED followed by ASP_LOG_ERROR

I've got a problem that for a website I'm administering, users are getting a 500 error. It happens across the site in a number of random places, like performing an Ajax query, navigating from page to page, etc. In the IIS error request log, what I'm seeing is two errors, back-to-back: ASP_CLIENT_DISCONNECTED and ASP_LOG_ERROR. Users are reporting problems usually happen when they're navigating from page to page. The 500 error appears and it just sits there. If they get the error, they usually refresh and it goes away.
The chain of calls right before the error look like the following.
ISAPI_START
CALL_ISAPI_EXTENSION
ASP_START_REQUEST
ASP_NEW_SESSION_CREATED
ASP_QUEUE_REQUEST
ASP_DEQUEUE_REQUEST
ASP_CLIENT_DISCONNECTED
Error 17:46:48.254
ASP_LOG_ERROR
Error LineNumber="", ErrorCode="ASP 0147", Description="500 Server Error" 17:46:48.254
MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName="IsapiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="500", HttpReason="Server Error", HttpSubStatus="0", ErrorCode="The operation completed successfully. (0x0)", ConfigExceptionInfo=""
EDIT 0: I think that the key may lie in that ASP_NEW_SESSION_CREATED line. I don't have any hard evidence to support that, just a gut feeling.
A few more details about my environment, I'm using an Application Pool that is in Classic Mode using the .NET Framework v2.0.5.2707. As part of the web site, I have two web applications that use a .NET 4.0 Application Pool in Integrated mode. The web applications aren't being used at all so I don't think they come into play.
Any suggestions about how to approach this one are greatly appreciated.
mj
We found the answer. There was an Ajax request that was timing out on the server and causing the problem. Some of the other calls were indeed due to user impatience.

Refreshing page with runtime error

I wonder if refreshing page with runtime error will overload the web server. For example I did refreshed domain.com/default.asp?id=99999999999999999999999999999999999999999 page which generates following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'Cint'
/default.asp, line 9
This caused server not respond for all sites hosted on it or my IP was blocked for some time by the firewall.
It depends on what the rest of the code around that error looks like (which you can't see). You won't overload the server in the sense of DoS too many requests (flood) since those would be handled before the request gets to IIS to process on the server side.
But if the code where the page breaks does other processing based on that value it could crash IIS or the app pool. It could also be stuck waiting on a passed DB call and has to timeout before the server responds. It will either time out or reset itself and that is when you see the site functional again.
Either way the code or the website/server should be setup better to alleviate the problem. Hopefully the admins will figure that out when they investigate why the site keeps crashing due to your web hits ;)
Issue seems to be type casting. Try below steps.
Add this line on top of the page where you get this error:
"Option Explicit"
You can get more meaning ful error message:
This link provide details for each error message.

What would cause a "Method error 12152" in a cascading dropdown list?

Bit of a long shot but has anyone come across a “Method error 12152” in a cascading dropdown list from the AJAX control toolkit? This is occurring in a system which is used globally but the error is only surfacing in Chinese language clients. There have been no recent codebase or server changes and the error has only just started and is occurring on multiple clients (again, only Chinese clients).
This doesn’t appear to be a server generated error as ASP.NET health monitoring is not picking up any events. A quick Google search only returns a handful of results and they’re predominantly in Chinese so my best guess is that this is a client generated error message possible related to an HTTP timeout but I'd really like a definitive answer on the error code.
I'm not sure you should rule out server errors. This is a symptom of a web service method call failing. I would double check the method in the debugger if you can.

ServerError due to Memory issues?

In my Project (ASP.NET, VB.NET), sometimes a Server Error is showing.
When this error is shown, Users cannot submit their Applications, so that they have to re-type full details and submit again.
How can I escape from these Server Errors?
I think the reason may be Memory issues. Because if the user try to submit again (after Sign Out->Sign In ) then they can submit. Daily twice or thrice Error is happening.
The word "Server" in the phrase "Server Error" refers to your ASP.NET code. You are the server!
If you are running .NET 2.0 or later, you can look into the Application event log (use the Event Viewer applet) for warnings from "ASP.NET". They will include details of what went wrong.
You need to debug your code to find out what's causing this, but the event logs will give you a starting point.
"Server Error" is just a generic message that indicates the the server code (your code) threw an exception that wasn't handled. It shows the user "server error" instead of a specific message so that no implementation details are exposed to outside users.
In other words, without debugging or looking at a log file or something, all you can tell from "Server Error" is that an Exception of any type was thrown.
Sorry, but the information you provided is not helpful in determining the issue.
I think that you'll need to provide a bit more info to get meaningful solutions.
Do you have server logs?
Can you debug through the app as the error occurs?
Does the error occur at a certain time of day, or after a certain regular action?
Does your app attempt to write to a file that may not be accessible?
is it possible that you are experiencing memory issues?
the list could go on, best to do some more investigation and if a more specific issue comes to light edit your question with the extra detail.
AFTER EDIT:
From the extra detail you've provided I wouldn't jump to memory as an issue, in signing out and back in the user is refreshing their session so everything is reset. If you are not seeing anything in your logs you'll need to look at your exception/error handling.
You just haven't provided enough info yet for us to work out the root issue, let alone suggest a solution. That's what you're seeing from all the answers here thus far. Find the event log info and there should be something there to help you, or at least something more to post here.
Try debugging the error? Server Error can be caused by various reasons.
Check for potential infinite loops.
Check for code in the constructor that might fail (especially for web services).
I think I've had cases like this which led to 'Server Error'. I'm assuming you mean the big red 'Server Error' message?
Save all your files and close your Visual Studio and now right click on Visual studio and run as administrator. It worked for me.

Resources