How to read posted form data in IIS 5.x filterRSS

1 reply

Last post Apr 03, 2010 03:00 PM by cheeso

  • How to read posted form data in IIS 5.x filter

    Aug 25, 2009 01:42 PM|brown9|LINK

    I have a filter (extends CHttpFilter) that registers for SF_NOTIFY_PREPROC_HEADERS in GetFilterVersion(), and OnPreprocHeaders gets called as expected at request-time.

    What I need to do is get access to data that was posted from an HTML form. I've tried registering for SF_NOTIFY_READ_RAW_DATA and overriding OnReadRawData, but what happens is that the DLL fails to load. It's repeatable- it I take out the SF_NOTIFY_READ_RAW_DATA in GetFilterVersion() then the DLL loads (and OnPreprocHeaders is called as normal). If I putback SF_NOTIFY_READ_RAW_DATA, loading fails.

    All I see in the System Log are entries like this:

    Source: W3SVC
    Category: None
    Type: Error
    EventID: 14
    User: N/A

    The HTTP Filter DLL C:\path\to\the.dll failed to load.  The data is the error.
    For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

    The Data section, showing Words, is
    0000: 0000007e

    Using OnReadRawData may not even be sufficient, since I need access to the data in my OnPreprocHeaders, but from the description of the event processing at http://msdn.microsoft.com/en-us/library/ms524855.aspx it looks like when OnPreprocHeaders is called there could still be pending calls to OnReadRawData.

    So better than a callback function like this would be a way to programmatically ask for the incoming data on demand, from within OnPreprocHeaders. I haven't seen a way to do that in a filter. Is there something I'm missing?

    Thanks for any ideas.

    isapi iis c++ ISAPI Filters OnReadRawData

  • Re: How to read posted form data in IIS 5.x filter

    Apr 03, 2010 03:00 PM|cheeso|LINK

    If you need to read the post data, I'd do it in an ISAPI Extension, not a Filter.

    See David Wang's post for why:

    http://blogs.msdn.com/david.wang/archive/2006/05/10/HOWTO-Access-POST-form-data-with-ISAPI.aspx

    ISAPI Extension POST