8

我正在使用 Umbraco 作为 CMS 的客户站点上工作。我需要创建一个自定义 404 错误页面。我已经尝试在 IIS 配置中执行此操作,但 umbraco 会覆盖它。

有谁知道如何在 Umbraco 中创建自定义 404 错误页面?有没有办法为运行时错误创建自定义错误页面?

4

5 回答 5

18

用您要显示的页面的 id/config/umbracoSettings.config修改<error404>1</error404>1 ”。

<errors>
   <error404>1</error404> 
</errors>

其他方法可以在Not found handlers中找到

于 2008-09-26T15:19:12.627 回答
9

如其他海报所述,按照指示修改错误部分(如果需要,包括文化。)此外,在 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>

在 /web.config

<system.webServer>
  <!-- Some other existing stuff -->
  <httpErrors existingResponse="PassThrough" />
</system.webServer>

(注意:这是 .NET 4)

于 2012-06-04T12:36:58.377 回答
8

umbraco 还支持文化相关的错误页面,以防您使用多语言网站...

配置稍有变化。代替

<errors>
  <error404>1050</error404>
</errors>

你现在要写

<errors>
  <errorPage culture="default">1</errorPage>-->
  <errorPage culture="en-US">200</errorPage>-->
</errors>

干杯,/德克

于 2009-07-15T07:19:41.803 回答
1

首先在您的 umbraco 安装中创建一个错误页面(和模板)。让我们说error.aspx。发布它。然后编辑config/umbracoSettings.config

Under <errors> section
    <error404>1111</error404>

其中1111是error.aspx 页面的umbraco 节点 ID

将鼠标悬停在内容部分的错误节点上可以找到节点 ID 。它通常是一个 4 位数字。

然后编辑web.config

    In <appSettings> section
    change <customErrors mode as show below:
<customErrors mode="RemoteOnly" defaultRedirect="~/Error.aspx"/>
于 2010-10-01T09:34:51.773 回答
0

目前umbracoSettings.conf必须通过以下方式进行配置才能使其以多语言方式工作:

    <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>
            <errorPage culture="default">1</errorPage>
            <errorPage culture="ru-RU">1</errorPage>
            <errorPage culture="en-US">2</errorPage>
        </error404>
    </errors>

请注意error404元素周围的errorPage元素,以及省略这个小而重要的细节的注释......

于 2011-04-26T10:58:18.580 回答