1

I have encountered the same problem and used the solution which were presented here: "ASP.NET Web API OperationCanceledException when browser cancels the request" . This works great but I still have an issue with error 500 which appears in the iis logs:

2016-05-01 13:46:31 ::1 POST /obo.Con.Web/1.0/config at=MDAxMDAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApV8goVQlvq2eNe0QKvXnHtHf4eFnGIptk0NNHyq8u3KBLSFfcU4D%2fb06yfU8X%2bUONdZYbRMVkC02UMoYCa56HLNEEZC2AzHrcYJm2eCswJOTpn1oYZRmBeY%3d&ct=iOS&cst=iPad&sv=2.2.0.64&cv=2.2.0.64 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/49.0.2623.112+Safari/537.36 500 0 64 1088

The problem is that our system identify this as an error. Is there a way to prevent this log from being written or maybe manipulate it in some way so it could be distinguish from a "real" 500 error?

Community
  • 1
  • 1
Amir M
  • 508
  • 1
  • 8
  • 28

1 Answers1

1

In Global.asax Application_Error I added this code:

 protected void Application_Error(object sender, EventArgs e)
 {
     if (Server.GetLastError() is OperationCanceledException)
     {
         Response.Clear();
         Server.ClearError();
      }
 }

This clears the last exception and error 500 is not being written to iis log

Amir M
  • 508
  • 1
  • 8
  • 28