首页 文章

通过HTTPS连接时,Ajax.BeginForm OnFailure返回空结果

提问于
浏览
0

通过非安全协议(http)连接时,我的MVC 5 Web应用程序正确返回错误消息 . 但是,当我通过https连接时,错误消息为空白 . 思想?注意:我也尝试json返回 . 谢谢!

浏览器调试器输出

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);

}

1 回答

  • 0

    我最终使用了一种解决方法 . 我返回OK响应并通过jquery确定消息类型,而不是返回失败响应 . 如果失败响应通过https返回消息,那将是很好的 .

相关问题