在 Umbraco CMS 中创建自定义错误页面
我正在开发一个使用 Umbraco 作为 CMS 的客户网站。 我需要创建一个自定义 404 错误页面。 我尝试在 IIS 配置中执行此操作,但 umbraco 覆盖了它。
有谁知道如何在 Umbraco 中创建自定义 404 错误页面? 有没有办法为运行时错误创建自定义错误页面?
I'm working on a client site who is using Umbraco as a CMS. I need to create a custom 404 error page. I've tried doing it in the IIS config but umbraco overrides that.
Does anyone know how to create a custom 404 error page in Umbraco?
Is there a way to create a custom error page for runtime errors?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在
/config/umbracoSettings.config
中,将1
"1" 修改为您想要的页面 ID展示。其他方法可以在 未找到处理程序
In
/config/umbracoSettings.config
modify<error404>1</error404>
"1" with the id of the page you want to show.Other ways to do it can be found at Not found handlers
正如其他发帖者所述,按照指示修改错误部分(如果需要,包括区域性。)此外,在 Web 配置中添加以下内容以启用错误传递到 umbraco:
在 /config/umbracoSettings.config 中(该文件本身解释了其用法):
在/web.config中
(注意:这是.NET 4)
As stated by other posters, modify the errors section as indicated (including culture if needed.) In addition, add the following in the web config to enable passthrough of errors to umbraco:
In /config/umbracoSettings.config (the file itself explains its usage):
In /web.config
(Note: This is .NET 4)
umbraco 还支持文化相关的错误页面,以防您使用多语言网站...
配置发生了一点点变化。 而不是
你现在写
干杯,
/短剑
umbraco also supports culture dependent error pages in case you're working with multilingual sites...
Config changes a tiny bit. Instead of
you'd now write
Cheers,
/Dirk
首先在 umbraco 安装中创建一个错误页面(和模板)。 让我们说error.aspx。 发布它。
然后编辑config/umbracoSettings.config。
其中1111是error.aspx页面的umbraco节点ID,
可以通过将鼠标悬停在内容部分中的错误节点上来找到节点ID。 通常是 4 位数字。
然后编辑web.config:
First create an error page (and template) in your umbraco installation. Let us say error.aspx. Publish it.
Then edit config/umbracoSettings.config.
Where 1111 is the umbraco node ID for the error.aspx page
Node ID can be found by hovering mouse on the error node in content section. It's usually a 4 digit number.
Then edit the web.config:
目前,必须按以下方式配置 umbracoSettings.conf 才能使其以多语言方式工作:
请注意
errorPage
周围的error404
元素code> 元素,以及省略这个小而重要的细节的注释......Currently
umbracoSettings.conf
has to be configured the following way in order to make it work in a multilingual way:Please note the
error404
element which surrounds theerrorPage
elements, as well as the comments omitting this small yet important detail...