Gth*_*n83 8 c# asp.net umbraco content-management-system
我正在使用Umbraco作为CMS的客户端站点上工作.我需要创建一个自定义404错误页面.我已尝试在IIS配置中执行此操作,但umbraco会覆盖它.
有谁知道如何在Umbraco中创建自定义404错误页面?有没有办法为运行时错误创建自定义错误页面?
Swa*_*ati 18
在/config/umbracoSettings.config修改<error404>1</error404>" 1 "中显示您要显示的页面的ID.
<errors>
<error404>1</error404>
</errors>
Run Code Online (Sandbox Code Playgroud)
其他方法可以在Not found handlers中找到
如其他海报所述,修改错误部分(如果需要,包括文化).此外,在Web配置中添加以下内容以启用umbraco的错误传递:
在/config/umbracoSettings.config中(文件本身解释了它的用法):
<errors>
<!-- the id of the page that should be shown if the page is not found -->
<!-- <errorPage culture="default">1</errorPage>-->
<!-- <errorPage culture="en-US">200</errorPage>-->
<error404>2664</error404>
</errors>
Run Code Online (Sandbox Code Playgroud)
在/web.config中
<system.webServer>
<!-- Some other existing stuff -->
<httpErrors existingResponse="PassThrough" />
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
(注意:这是.NET 4)
小智 8
umbraco还支持文化相关的错误页面,以防您使用多语言网站...
配置稍有变化.代替
<errors>
<error404>1050</error404>
</errors>
Run Code Online (Sandbox Code Playgroud)
你现在写
<errors>
<errorPage culture="default">1</errorPage>-->
<errorPage culture="en-US">200</errorPage>-->
</errors>
Run Code Online (Sandbox Code Playgroud)
干杯,/德克