【问题标题】:Orchard Cms Custom 404 wont display within normal page LayoutOrchard Cms Custom 404 不会在正常页面布局中显示
【发布时间】:2013-03-22 05:42:32
【问题描述】:

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

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

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

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

【问题讨论】:

标签: http-status-code-404 orchardcms


【解决方案1】:

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

如果是这样,那么这里已经报告了这个问题: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 是否适用于 The Theme Machine。然后我安装并启用“重写规则”模块版本 1.2.5,您应该能够在没有布局的情况下看到 NotFound.cshtml 的内容。禁用重写规则模块将其恢复正常。)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-27
    相关资源
    最近更新 更多