问题
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.
回答1:
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();
来源:https://stackoverflow.com/questions/30285159/access-httpconfiguration-in-orchard-cms