Jquery mobile jQuery mobile和mvc4,如何重定向到自定义错误页面替换;加载页面时出错";消息
当发生未处理的异常时,我正在尝试设置自定义错误页(视图/共享文件夹中的error.vbhtml)。我只看到黄色背景上的“错误加载页面”消息 以下是我迄今为止为实现目标所做的工作:Jquery mobile jQuery mobile和mvc4,如何重定向到自定义错误页面替换;加载页面时出错";消息,jquery-mobile,asp.net-mvc-4,Jquery Mobile,Asp.net Mvc 4,当发生未处理的异常时,我正在尝试设置自定义错误页(视图/共享文件夹中的error.vbhtml)。我只看到黄色背景上的“错误加载页面”消息 以下是我迄今为止为实现目标所做的工作: 我已经在web.config中设置了customErrors mode=“On” 已检查FilterConfig.vb中是否存在filters.Add(New HandleErrorAttribute()) 引发了一个异常,使用firebug的Net选项卡处理发生错误的页面,可以看到HTML选项卡在error.vbht
感谢您的帮助。通过在_Layout.vbhtml中添加以下javascript代码解决了此问题
<script type="text/javascript">
$(document).live("pagechangefailed", function (e, data) {
//alert("pagechangefailed live");
var url = '@Url.Action("CustomError", "Account")';
window.location.href = url;
});
</script>
$(document).live(“pagechangefailed”,函数(e,数据){
//警报(“pagechangefailed live”);
var url='@url.Action(“CustomError”、“Account”);
window.location.href=url;
});
其中CustomError是AccountController中新创建的操作