0

Is it possible to create any kind of handler to handle the output response from an ASP.NET page?

My scenario: I have a third party application (source code not provided) written in ASP.NET/C# hosted in IIS 7, and I want to create a 'handler' so that I can get the output HTML response and modify its HTML code.

To my knowledge, the pluggable HTTPModules and HTTPHandlers can only handle the request message, but not the output. Is it correct?

Any other method to achieve the same result?

Thanks in advance.

karthikr
  • 97,368
  • 26
  • 197
  • 188
Bruno
  • 87
  • 9

2 Answers2

0

You can use HttpModule and register your Filter which can change output! Just register that module in web.config, and voilà!
Example for HttpModule is available on MSDN: http://msdn.microsoft.com/en-us/library/bb398986(v=vs.100).aspx, and filters are explained here: http://aspnetresources.com/articles/HttpFilters

Hrvoje Hudo
  • 8,994
  • 5
  • 33
  • 42
  • It worked! The only difference is that I had to hook the Filter on the BeginRequest event. In the Write method I can make my modifications in the HTML code (at least for now). – Bruno Jan 09 '13 at 19:33
0

Can you not just use HttpWebRequest for this type of situation and call the page in your application?

Check this article out

Stokedout
  • 11,003
  • 5
  • 24
  • 30
  • What I want is the browser to call originalpage.aspx as intended, IIS processes it and returns the HTML output and my 'handler' modifies this HTML. So, no HttpWebRequest used here. – Bruno Jan 09 '13 at 18:36