title: How to read header in controller constructor
body: <p>Is it possible to read header <code>Authorization</code> in my controller constructor? and how? and is this the best solution (reading header value in controller constructor) to achieve my goal ?</p>
  
  <p>the following is my code of my classes that inherit an interface:</p>
  
  <pre><code>public interface IProvider
  {
      string SendData(string data);
      //other methods
  }
  
  public class FirstProvider : IProvider
  {
      private string _url;
      public FirstProvider(string url)
      {
          _url = url;
      }
  
      public string SendData(string data)
      {
          //send data to First provider website (_url)
          //return result
      }
  }
  
  public class SecondProvider : IProvider
  {
      //some code
  }
  </code></pre>
  
  <p>And the following API controller:</p>
  
  <pre><code>public class ProviderController : ApiController
  {
      private IProvider _provider;
  
      public ProviderController()
      {
          //read authorization key from headers (How??)
          string authToken;
  
          //fetch from database/cache what provider to use based on the authorization key
          var provider = Providers.GetProvider(authToken);
          //Initialize _provider based on the database query result
          if (provider.Name == "a")
          {
              _provider = new FirstProvider(provider.Data);
          }
          else if (provider.Name == "b")
          {
              _provider = new SecondProvider(provider.Data);
          }
          //Other providers will be added in future
      }
  
      public ProviderController(IProvider provider)
      {
          _provider = provider;
      }
  
      public IHttpActionResult SendData(string data)
      {
          _provider.SendData(data);
          return Ok();
      }
  }
  </code></pre>