0

The Asp.Net System.Web.HttpRequest class allows an incoming request to be modified by using the Filter property to attach a stream filter to the incoming data stream.

This was introduced in .Net 1.1 and is documented using Global.asax in this MSDN article

Since the .Net 1.1 release, Asp.Net has become a pretty big bag of tricks. I am trying to figure out in what configurations this technique works and in what situations it fails.

Please add answers for different configurations. For example:

  • Does this work for Web Api?
  • Does this work for WCF web services?
  • Does anyone know why url routing causes problems?
Mark Arnott
  • 1,975
  • 3
  • 17
  • 28
  • The answer to this SO question incorrectly says this is not possible in an HttpModule. http://stackoverflow.com/questions/3058956/is-it-possible-to-modify-the-content-of-httprequest-post-in-an-iis-httpmodule – Mark Arnott Nov 10 '15 at 17:09
  • This SO post claims success, but does not specify the specifics of the configuration. http://stackoverflow.com/questions/3240170/how-can-i-modify-a-post-request-using-a-custom-ihttpmodule-and-an-httprequest-fi – Mark Arnott Nov 10 '15 at 17:11
  • I've posted an answer to a similar question here. http://stackoverflow.com/questions/3058956/is-it-possible-to-modify-the-content-of-httprequest-post-in-an-iis-httpmodule/35590493#35590493 – Snives Feb 23 '16 at 23:41

1 Answers1

0

Using IIS 7.5 (on Windows 7), if routing is enabled and the request url causes IIS to do an internal redirect, the filtering will not work.

The filter class's constructor will be called, but the filter class's Read method never gets called. (and yes I did use the override key word on the Read method).

Mark Arnott
  • 1,975
  • 3
  • 17
  • 28