丹尼尔·雷森(Daniel Leiszen)
我想在Orchard 1.8.1中启用CORS(跨域请求)。为此,我关注了这篇文章。但是,我不知道如何为我的WebAPI控制器访问HttpConfiguration。我尝试使用ControllerContext.Configuration,但它似乎始终为NULL。
在Orchard中访问HttpConfiguration并调用EnableCors()的正确方法是什么?
先感谢您。
丹尼尔·雷森(Daniel Leiszen)
当我发现Orchard使用GlobalConfiguration时,我创建了一个外壳钩子来推动模块中的IOrchardShellEvents,并在Activated方法实现内部调用了System.Web.Http.GlobalConfiguration.Configuration.EnableCors();。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
编辑于
我来说两句