ASP.NET MVC 4 - Exception Handling Not Working

前端 未结 4 1475
执念已碎
执念已碎 2020-12-30 09:34

When an error occurs in my ASP.NET MVC 4 application, I would like to customize a view for the user depending on the type of error. For example, page not found or an except

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 10:08

    I faced a similar problem and lost sometime trying to work out what was going on. So just in case any others face a similar problem here is what my problem was.

    The error page was trying to use my _Layout page. Just ensure that you Error.cshtml page has

    @{ Layout = null; }

提交回复
热议问题