IHTTPModule - Not working as expected RRS feed

  • Question

  • User1723271247 posted


    I have built a custom IHTTPModule to aquire session variables so I can rewrite to a page based on a session variable.   I got everything to work on my local machine (IIS 7.5 Windows 7 Ultimate) but when I upload it the server (Windows 2008 R2) with the same version of .NET 4 and modules/handlers my IHTTPModule does not fire correctly.

    These are the events that do not work properly on the server but do locally.

    AddHandler Appl.PostAcquireRequestState, AddressOf Rewrite_PostAcquireRequestState
    AddHandler Appl.PostMapRequestHandler, AddressOf Rewrite_PostMapRequestHandler

    When I call those handlers on my local IIS 7.5 they run properly and do not get a 404 error but when I place them on the server I get a 404 Error.   If the page exists, the handlers run as expected but that does me no good because I need them for the rewrite and the session.

    AddHandler Appl.BeginRequest, AddressOf Rewrite_BeginRequest
    AddHandler Appl.AuthenticateRequest, AddressOf Rewrite_AuthenticateRequest

    This handler works properly and output to the page before a 404 error on both the server and local but I can not use these because I need a session. 

    Why would they act differently on the server than locally on my machine?  I have tried everything I can think of.  Any suggestions?

    Thank you for the help.

    Thursday, April 14, 2011 2:03 AM

All replies

  • User-1385293039 posted

    It should be a setting in your IIS on the server. Compare them to your local IIS. 

    Check the AppPool version

    Check handlers

    Can you copy your web.config and your handlers and modules list from IIS in here?

    Thursday, April 14, 2011 12:10 PM
  • User1723271247 posted

    I have checked all of those:

    AppPool: exactly the same.

    Handlers: is there a way to get a list from IIS 7.5?

    I have created a test site just to see what gets executed (just a ihttpmodule) and it still executes a 404 page before PostMapRequestHandler.  Still one works locally and the one on the server does not work.  I have tested up till PostAuthorizeRequest and it works on both.  After that I do not know what is going on.




            <compilation debug="false" targetFramework="4.0" />
              <add type="Samples.AspNet.VB.CustomHTTPModule" name="CustomHttpModule" />
          <httpRuntime requestValidationMode="2.0" />
          <validation validateIntegratedModeConfiguration="false" />
            <add type="Samples.AspNet.VB.CustomHTTPModule" name="CustomHttpModule" />




    Thursday, April 14, 2011 1:14 PM
  • User-1385293039 posted

    Check the HttpHandlers section in your website configuration in IIS. Are both of the versions (local and server) of the app pool the same? both classic or both integrated?

    Friday, April 15, 2011 10:26 AM
  • User1213293420 posted

    I was having the same problem.

    This worked

    <modules runAllManagedModulesForAllRequests="true">
    <add type="Samples.AspNet.VB.CustomHTTPModule" name="CustomHttpModule" />
    Monday, August 22, 2011 1:35 PM