[英]Custom error handling in MVC 4
I have build language specific custom error pages. 我有特定于语言的自定义错误页面。 and i am using http errors in web.config.still i am getting default iis error response.
并且我在web.config.still中使用HTTP错误,但仍在获取默认的iis错误响应。 here are the code sniplets
这是代码片段
<httpErrors defaultResponseMode="File" errorMode="DetailedLocalOnly" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="error" path="error.htm"/>
</httpErrors>
i have overidden mode to allow in httperror section in apphostconfig. 我在apphostconfig的httperror部分中允许设置覆盖模式。 i have also set custom error mode to off.
我也将自定义错误模式设置为关闭。 and i am not using standard ~/Views/Shared/Error.cshtml page.
而且我没有使用标准的〜/ Views / Shared / Error.cshtml页面。
I'm using this: 我正在使用这个:
<customErrors mode="On" defaultRedirect="/Error/ServerError">
<error statusCode="404" redirect="/Error/NotFound" />
<error statusCode="500" redirect="/Error/ServerError" />
</customErrors>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.