highlight filter 异常 .aspx redirect view ide 错误 cnblogs
- /// <summary>
- /// 标记了HandleError,并指明错误处理页为AboutError.aspx
- /// </summary>
- /// <returns></returns>
- [HandleError(View = "AboutError")]
- public ActionResult About()
- {
- return View();
- }
重写OnException
- protected override void OnException(ExceptionContext filterContext)
- {
- // 标记异常已处理
- filterContext.ExceptionHandled = true;
- // 跳转到错误页
- filterContext.Result = new RedirectResult(Url.Action("Error", "Shared"));
- }
来源: http://www.bubuko.com/infodetail-2357049.html