【问题标题】:Access HttpConfiguration in Orchard CMS在 Orchard CMS 中访问 HttpConfiguration
【发布时间】:2015-05-17 09:02:12
【问题描述】:

我想在 Orchard 1.8.1 中启用 CORS(跨域请求)。为此,我关注了this article。但是,我不知道如何访问我的 WebAPI 控制器的 HttpConfiguration。我尝试使用 ControllerContext.Configuration,但它似乎始终为 NULL。

在 Orchard 中访问 HttpConfiguration 并调用 EnableCors() 的正确方法是什么?

提前谢谢你。

【问题讨论】:

  • 当我认为 Orchard 使用 GlobalConfiguration 时,我在我的模块中创建了一个执行 IOrchardShellEvents 的 shell 挂钩,并在 Activated 方法实现中调用了 System.Web.Http.GlobalConfiguration.Configuration.EnableCors();
  • 就是这样。您应该将此作为答案发布

标签: orchardcms orchardcms-1.8


【解决方案1】:

当我发现 Orchard 使用 GlobalConfiguration 时,我在我的模块中创建了一个执行 IOrchardShellEvents 的 shell 挂钩,并在 Activated 方法实现中调用了 System.Web.Http.GlobalConfiguration.Configuration.EnableCors();

【讨论】:

    猜你喜欢
    • 2012-05-26
    • 1970-01-01
    • 2011-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-05
    • 2015-10-27
    相关资源
    最近更新 更多