通过非安全协议(http)连接时,我的MVC 5 Web应用程序正确返回错误消息。但是当我通过https连接时,错误消息为空白。思想?注意:我也尝试json return。谢谢!
浏览器调试器输出
HTTP
HTTPS
MVC Controller:
string message = string.Join(" ", errors);
Response.StatusCode = (int)HttpStatusCode.RequestedRangeNotSatisfiable;
return new HttpStatusCodeResult(Response.StatusCode, string.Join(" ", message));
Script:
function ajaxOnFailure(response, status, error) {
debugger;
if (response.status == 500) {
error = "An internal error has occurred. Please try again. If the problem persists, please contact IT."
}
toastr.error("", error);
}