[英]Custom error handling in MVC 4
我有特定於語言的自定義錯誤頁面。 並且我在web.config.still中使用HTTP錯誤,但仍在獲取默認的iis錯誤響應。 這是代碼片段
<httpErrors defaultResponseMode="File" errorMode="DetailedLocalOnly" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="error" path="error.htm"/>
</httpErrors>
我在apphostconfig的httperror部分中允許設置覆蓋模式。 我也將自定義錯誤模式設置為關閉。 而且我沒有使用標准的〜/ Views / Shared / Error.cshtml頁面。
我正在使用這個:
<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.