簡體   English   中英

在Umbraco CMS中創建自定義錯誤頁面

[英]Creating a custom error page in Umbraco CMS

我正在使用Umbraco作為CMS的客戶端站點上工作。 我需要創建一個自定義404錯誤頁面。 我已嘗試在IIS配置中執行此操作,但umbraco會覆蓋它。

有誰知道如何在Umbraco中創建自定義404錯誤頁面? 有沒有辦法為運行時錯誤創建自定義錯誤頁面?

/config/umbracoSettings.config修改<error404>1</error404>1 ”,其中包含您要顯示的頁面的ID。

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

其他方法可以在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>

在/web.config中

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

(注意:這是.NET 4)

umbraco還支持文化相關的錯誤頁面,以防您使用多語言網站...

配置稍有變化。 代替

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

你現在寫

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

干杯,/德克

首先在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"/>

目前,必須按以下方式配置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元素,以及省略這個小但重要細節的注釋...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM