title: HttpModule to add headers to request
body: <p>This seems like a simple operation.</p>
  
  <p>We have a need in our development environment (running on XP/IIS 5) to add some headers into each HttpRequest arriving at our application.  (This is to simulate a production environment that we don't have available in dev).  At first blush, this seemed like a simple HttpModule, along the lines of: </p>
  
  <pre><code>public class Dev_Sim: IHttpModule
  {
      public void Init(HttpApplication app)
      {
          app.BeginRequest += delegate { app.Context.Request.Headers.Add("UserName", "XYZZY"); };
      }
  
      public void Dispose(){}
  }
  </code></pre>
  
  <p>But on trying to do that, I find that the Headers collection of the Request is read-only, and the Add method fails with an OperationNotSupported exception.</p>
  
  <p>Spending a couple hours researching this on Google, I've come up with no easy answer to what should be a relatively straight-forward problem.</p>
  
  <p>Does anyone have any pointers?</p>