[英]creating language specific error pages in MVC4
hi i have created language specific error pages using HTTP errors in IIS. 嗨,我已经使用IIS中的HTTP错误创建了特定于语言的错误页面。
But have few issues. 但是问题很少。 i have set language preference in IE.
我已经在IE中设置了语言偏好。
<httpErrors defaultResponseMode="File" errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="error" path="error.htm"/>
</httpErrors>
So whenever i run my application error pages are getting displayed only in IE preferred language.so if i change application language. 因此,每当我运行我的应用程序错误页面时,它们只会以IE首选语言显示。因此,如果我更改了应用程序语言。 its not selecting application language only error pages are getting displayed in IE preferred language..
其未选择应用程序语言,仅错误页面以IE首选语言显示。
you can add an Application_OnError on Global.asax and check if the error is a 404. 您可以在Global.asax上添加Application_OnError并检查错误是否为404。
In this case you can overwrite the controller and action (ie ErrorController and NotFound action) passing a parameter of the application language 在这种情况下,您可以通过应用程序语言的参数覆盖控制器和操作(即ErrorController和NotFound操作)
in the action you can use resource file to populate the model 在操作中,您可以使用资源文件填充模型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.