HttpModule Strange Behaviour RRS feed

  • Question

  • User-1681124835 posted

    Hello All,

    I've implemented a very simple HttpModule which goal is to add a simple HTML comment at the bottom of every page/webservice served by IIS. I've configured the web.config file properly.

    What happens, in debug mode but even when deployed on my local IIS, is that the events are intercepted correctly (all the breakpoints on Init method and the callback function associated with the event PreSendRequestContent are fired) but none text is added.

    Any Idea?

    I've pasted in the following the source code ofthe HttpModule.

    public class PageSignatorHttpModule: IHttpModule
    HttpApplication httpApplication;
    public PageSignatorHttpModule() {}

    public void Dispose()
    throw new Exception("The method or operation is not implemented.");

    public void Init(HttpApplication context)
    httpApplication = context;
    httpApplication.PreSendRequestContent +=
    new EventHandler(httpApplication_PreSendRequestContent);

    void httpApplication_PreSendRequestContent(object sender, EventArgs e)


    Wednesday, February 21, 2007 8:12 PM


  • User113421904 posted



    The following sample works:


            public void Init(HttpApplication context)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>


                httpApplication = context;<o:p></o:p>

                httpApplication.PreSendRequestHeaders += new EventHandler(httpApplication_PreSendRequestHeaders);<o:p></o:p>


    <o:p> </o:p>

            void httpApplication_PreSendRequestHeaders(object sender, EventArgs e)<o:p></o:p>


                httpApplication.Response.Output.Write("your signature");<o:p></o:p>



    Good Luck!



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 24, 2007 2:00 AM