Hi,
I need to rewrite the domain names on web pages served by a DLL that I have no way to change. I thought if there were events like OnFlush before Response.Flush occurs on the page I could do it all before the page is displayed. Is there a way to do this in ASP?
Thanks for your help.
P.S.: Something like Script_OnFlush in this APACHE extension: http://www.apache-asp.org/events.html
Following Nick's suggestion I have created a class that inherits from the Stream class. Response.Filter is using this class to work on the HTML content...
By overriding the Write method I managed to rewrite the domain names on the site.
public override void Write(byte[] buffer, int offset, int count)
{
byte [ ] data = new byte [ count ];
Buffer.BlockCopy ( buffer, offset, data, 0, count );
string myHTML = ASCIIEncoding.ASCII.GetString(data);
string convertedHTML = myHTML.Replace("http://www.previousdomain.com", "http://www.currentdomain.com");
data = ASCIIEncoding.ASCII.GetBytes(convertedHTML);
_sink.Write ( data, 0, count );
}
Thanks Nick!