I’m having a situation that is getting kind of annoying with asp.net web api. The thing is i have an API which is already in production, however I’m constantly making changing and deploying again.
I have a filter, which takes care of checking if the request is https, that works awesome on production, but when requests are local the filter blocks all http requests, which is not what I want. I would like to allow local requests with http. I have a filter which does the exact same thing on MVC3, and I can do something like:
filterContext.HttpContext.Request.IsLocal
Is there any work around to this problem?
if you are using webhost i.e hosting webapi in asp.net, you can access the HttpContext using
You can then use
httpContextBase.Request.IsLocalto determine if the request is local.