在 Umbraco 中设置 errorPage

发布于 2024-10-08 06:52:29 字数 215 浏览 0 评论 0原文

我正在使用 Umbraco 开发一个 Web 应用程序。我创建了一个名为 PageNotFound 的内容,并在 umbracoSettings.config 文件的错误部分中,放置了 404 error404 的节点 ID。问题是,在 IIS 7 中,IIS 始终在 web.config 中查找 HttpErrors 部分,而不关注 umbracoSettings.config。

我应该怎么办?

I am developing a web application using Umbraco. I create a content called PageNotFound and, in the errors section of umbracoSettings.config file, I put the node id of that for 404 error404. The problem is that, with IIS 7, IIS always looks for the HttpErrors section in web.config and does not pay attention to umbracoSettings.config.

What should I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瑾夏年华 2024-10-15 06:52:29

在 web.config(system.webServer 部分)中,您可以告诉站点将所有错误处理传递给应用程序:

<httpErrors existingResponse="PassThrough" />

这样做的缺点是 Umbraco 除了未找到的 .aspx 页面外不处理任何内容。

你可以通过做这样的事情来使它更好:

<httpErrors errorMode="Custom">
       <remove statusCode="404" subStatusCode="-1" />
       <error statusCode="404" prefixLanguageFilePath="" path="/non-existing-page.aspx" responseMode="ExecuteURL" />
</httpErrors>

The non-existing-page.aspx 在 Umbraco 中还不存在,所以它触发了 404(因为它有 aspx 扩展名)并且.. 急:Umbraco 完美地处理了 404 !

In your web.config (system.webServer section) you can tell the site to pass all of the error handling through to the application:

<httpErrors existingResponse="PassThrough" />

This has the disadvantage that Umbraco doesn't handle anything but .aspx pages that are not found.

You could make it better by doing something like this instead:

<httpErrors errorMode="Custom">
       <remove statusCode="404" subStatusCode="-1" />
       <error statusCode="404" prefixLanguageFilePath="" path="/non-existing-page.aspx" responseMode="ExecuteURL" />
</httpErrors>

The non-existing-page.aspx does not exist yet in Umbraco, so it triggers a 404 (because it has the aspx extension) and.. presto: Umbraco handles the 404 perfectly!

围归者 2024-10-15 06:52:29

添加才起作用

existingResponse="Replace"

500 个错误直到我这样

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="404" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="404" path="/non-existing-page.aspx" responseMode="ExecuteURL" />
  <error statusCode="500" path="error.html" responseMode="File" />
</httpErrors>

The 500 errors did not work until I added

existingResponse="Replace"

like that

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="404" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="404" path="/non-existing-page.aspx" responseMode="ExecuteURL" />
  <error statusCode="500" path="error.html" responseMode="File" />
</httpErrors>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文