Search code examples
orchardcmsorchardcms-1.8

Access HttpConfiguration in Orchard CMS


I would like to enable CORS (Cross-Origin Request) in Orchard 1.8.1. I followed this article for the purpose. However, I don't know how to access HttpConfiguration for my WebAPI Controller. I tried to use ControllerContext.Configuration, but it seems to be always NULL.

What is the proper method to access HttpConfiguration in Orchard and to call EnableCors()?

Thank you in advance.


Solution

  • As I figured Orchard uses GlobalConfiguration, I created a shell hook impelmenting the IOrchardShellEvents in my module, and inside the Activated method implementation I called System.Web.Http.GlobalConfiguration.Configuration.EnableCors();