title: C# HTTPModule Could not load type CGI Request
body: <p>Trying to use a HTTPModule I wrote in complied C# class project to log request values and extend a third party CGI shopping cart. My module works fine with asp,asp.net,jpg and html request, but soon as I request the store.cgi, I get the following error. Do I have to do something special in IIS7 or does HTTPModule not work with a CGI executables running in CGI-BIN? </p>
  
  <h2>Server Error in '/cgi-bin' Application.</h2>
  
  <p>Could not load type 'IISWatcher.WatchRequests'. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.Web.HttpException: Could not load type 'IISWatcher.WatchRequests'.</p>
  
  <p>Source Code:</p>
  
  <pre>
  
  
  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Web;
  using System.Messaging;
  
  namespace IISWatcher
  {
      public class WatchRequests : IHttpModule
      {
          public void Init(System.Web.HttpApplication app)
          {
              app.BeginRequest += new EventHandler(app_BeginRequest);
              app.EndRequest += new EventHandler(app_EndRequest);
          }
          void app_EndRequest(object sender, EventArgs e)
          {
              //HttpApplication app = (HttpApplication)sender;
          }
          void app_BeginRequest(object sender, EventArgs e)
          {
              string strReturn = "\r\n";
              HttpApplication app = (HttpApplication)sender;
              string strAddress = app.Request.UserHostAddress;
              string strUrl = app.Request.Url.AbsoluteUri;
              string strQS = app.Request.QueryString.ToString();
              RequestInfo ri = new RequestInfo();
              System.Diagnostics.EventLog.WriteEntry("HttpModule", 
                  "IpAddress: " + strAddress + strReturn + "URL:" + strUrl);
              System.Messaging.MessageQueue msq = new MessageQueue(@".\private$\HttpModuleQueue");
              ri.AbsoluteUri = strUrl;
              ri.IPAddress = strAddress;
              ri.QueryString = strQS;
              msq.Send(ri);
          }
  
          public void Dispose()
          {
          }
      }
      public class RequestInfo
      {
          public string IPAddress;
          public string AbsoluteUri;
          public string QueryString;
      }
  }
  
  </pre>
  
  <p>Web.config for IIS7:</p>
  
  <p>
  ...................
      
          
              
          
      
  </p>