设置的errorPage的一把umbracoerrorPage、umbraco

2023-09-04 00:09:24 作者:-今生注定要漂泊ゝ

我正在开发使用一把umbraco一个Web应用程序。我创建了一个名为PageNotFound和内容umbracoSettings.config文件的错误部分,我把该节点ID为404 error404。问题是,与IIS 7,IIS一直在寻找在web.config中HttpErrors部分,不注重umbracoSettings.config。

I am developing a web application using Umbraco. I create a content called PageNotFound and 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 looking for HttpErrors section in web.config and does not pay attention to umbracoSettings.config.

为什么我应该怎么办?

推荐答案

在你的web.config(system.webServer节),你可以告诉网站通过所有的错误处理,通过对应用程序的:

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" />

这都有一把umbraco不处理任何事情,但没有被发现的.aspx页面的缺点。

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>

不存在的,page.aspx尚不存在于一把umbraco,所以触发404(因为它在aspx扩展名),.. preSTO:一把umbraco处理404完美

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!