http-status-code-404 - Orchard Cms 自定义 404 不会在正常页面布局中显示

标签 http-status-code-404 orchardcms

我已在 Orchard CMS 网站上创建了自定义 404 页面和自定义错误页面,如 David Haydan's Blog 中所述。

自定义模板工作正常。但是,错误显示时没有任何正常的页面布局。或样式

enter image description here

如何使用默认的 Layout.cshtml 来呈现此内容?

当我切换到主题机 Theme 时也会发生这种情况。

最佳答案

您是否使用重写规则模块?

如果是这种情况,则此问题已在此处报告:http://orchardrewriterules.codeplex.com/workitem/11

它说:“它可以通过 ThemedAttribute 修复”。这是通过在项目 Contrib.RewriteRules/Controllers/HomeController.cs 的 HomeController 中添加属性“Themed”来完成的。完成后,它将如下所示:

using Orchard.Themes;
using System.Web.Mvc;

namespace Contrib.RewriteRules.Controllers {
  [Themed]
  public class HomeController : Controller {
    public ActionResult Rewrite(string path) {
      return new HttpNotFoundResult();
    }
  }
}

(重现错误很简单。启动一个全新的 Orchard 站点,并测试 404 是否可以与 Theme Machine 配合使用。然后我安装并启用“重写规则”模块版本 1.2.5,您应该能够看到没有布局的NotFound.cshtml的内容。禁用重写规则模块可以恢复正常。)

关于http-status-code-404 - Orchard Cms 自定义 404 不会在正常页面布局中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14585136/

相关文章:

asp.net - 将异常转换为 Application_Error 中的 HTTP 404 响应

css - Orchard 1.10.2 - 工作流事件的样式问题

java - 如何在Java中模拟一个站点?

python - 即使使用 --insecure 后 Django 图像也不会加载

java - HTTP 404 Java Servlet

rest - 无法在 Netbeans 上使用 Maven、Tomcat 7 创建 REST Web 服务

azure - 将站点更新从 Orchard 部署到 Azure

orchardcms - 在自定义内容类型的详细信息和摘要模式下创建两个单独的媒体库选择器替代字段

azure - 将 Windows Azure 项目从库加载到 Visual Studio 2012

asp.net - Orchard CMS - 在内容项编辑器中维护查询字符串值