YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* コントローラーのOnException()メソッド [#fa1dfa4f]
protected override void OnException(ExceptionContext fil...
{
if (filterContext.HttpContext.IsCustomErrorEnabled) {
var vr = new ViewResult();
vr.ViewName = "~/Views/Shared/MyError.cshtml";
vr.ViewBag.ControllerName = (string) filterConte...
vr.ViewBag.ActionName = (string) filterConte...
vr.ViewBag.Exception = filterContext.Except...
filterContext.Result = vr;
filterContext.ExceptionHandled = true;
}
}
- 上のようなOnException()メソッドを各コントローラークラス...
- もしくは、一括で処理する場合、各コントローラークラスが...
** コントローラー外でのエラーを例外処理する場合はApplicat...
global.asax.csにApplication_Error()を作成する。
** 参考 [#c7c6ee0e]
- http://prideparrot.com/blog/archive/2012/5/exception_ha...
- http://stackoverflow.com/questions/10354833/advantages-...
- http://miso-soup3.hateblo.jp/entry/20120926/1348657714
終了行:
* コントローラーのOnException()メソッド [#fa1dfa4f]
protected override void OnException(ExceptionContext fil...
{
if (filterContext.HttpContext.IsCustomErrorEnabled) {
var vr = new ViewResult();
vr.ViewName = "~/Views/Shared/MyError.cshtml";
vr.ViewBag.ControllerName = (string) filterConte...
vr.ViewBag.ActionName = (string) filterConte...
vr.ViewBag.Exception = filterContext.Except...
filterContext.Result = vr;
filterContext.ExceptionHandled = true;
}
}
- 上のようなOnException()メソッドを各コントローラークラス...
- もしくは、一括で処理する場合、各コントローラークラスが...
** コントローラー外でのエラーを例外処理する場合はApplicat...
global.asax.csにApplication_Error()を作成する。
** 参考 [#c7c6ee0e]
- http://prideparrot.com/blog/archive/2012/5/exception_ha...
- http://stackoverflow.com/questions/10354833/advantages-...
- http://miso-soup3.hateblo.jp/entry/20120926/1348657714
ページ名: