我无法在AJAX请求的错误处理程序中获取正确的错误代码。每次发生错误,则返回我的StatusCode = 500。我想在我的服务明确地将它设置为HttpContext.Current.Response.StatusCode = 403;
,但它仍然给了我状态= 500无法在AJAX中获取正确的状态代码错误处理程序
这是我的AJAX请求看起来像:
$.ajax({
type: "POST",
url: "Services/someSvc.asmx/SomeMethod",
cache: true,
contentType: "application/json; charset=utf-8",
data:"{}",
dataType: "json"
error: ajaxFailed
});
function ajaxFailed(xmlRequest) {
alert(xmlRequest.status + ' \n\r ' + //This is always 500.
xmlRequest.statusText + '\n\r' +
xmlRequest.responseText);
}
我在这里失踪了什么?
您是否在SomeMethod上设置了服务器端断点? –