Reputation: 14088
I have some error processing for ajax request to WCF service on client side,
self.remove = function (dep, processingResult) {
var data = { "id": dep };
$.ajax({
url: 'my.svc/remove',
type: 'POST',
contentType: 'application/json',
dataType: "json",
cache: false,
data: JSON.stringify(data),
complete: function (e, xhr, settings) {
var message = self.getMessage(e.status);
switch (e.status) {
case 200:
processingResult();
break;
case 417:
console.log(e.statusText);
radalert(message + e.statusText, null, null, "417");
break;
default:
{
console.log(e.statusText);
radalert(message, null, null, "bekey");
}
}
}
});
};
in some case I return error 417, but IE9 getting result with some 12019 error instead. all other browsers including IE10 getting correct value.
Why does it happens and how to fix it ?
12019 - ERROR_INTERNET_INCORRECT_HANDLE_STATE The requested operation cannot be carried out because the handle supplied is not in the correct state.
Looks like return this code is not so good practice. Am I right ?
WebOperationContext ctx;
//....
ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.ExpectationFailed;//417
//...
Upvotes: 1
Views: 10653
Reputation: 57085
If clearing the cache doesn't help, it's likely that this is related to how URLMon wraps certain HTTP error status codes; for instance IE9 and below would convert a HTTP/204 response into a bogus 1223 status code (see http://www.enhanceie.com/ie/bugs.asp)
This problem was fixed in IE10 such that the server's response status is correctly returned to the script.
Upvotes: 2