I'm building a WebApi application which needs to authenticate for every request by validating credentials from the HTTP header sent.
I was hoping to use an HttpModule for this, but when I debug, the module is only hit when I start the app. I can actively fire requests at a controller action and it will never hit the HttpModule (and thus never check credentials).
I've activated the HttpModule in the web.config like so:
<system.webServer>
<modules>
<add name="BasicAuthHttpModule" type="MyAssembly.Modules.BasicAuthHttpModule"/>
</modules>
Why does the module not run when I call the controller - is this method not appropriate for authenticated WebApi apps? I can't use IIS authentication in my case.