SF_NOTIFY_SEND_RESPONSE

Jul 10, 2008 at 3:29 PM
Does anybody have an example of how this would work? I need to search the response back to the browser and replace some text if found. I can not find a good example of how to do this.

Any help would be appreciated.
Coordinator
Jul 14, 2008 at 11:30 AM
Edited Jul 14, 2008 at 11:34 AM
Hi,

When SF_NOTIFY_SEND_RESPONSE is signaled to the ISAPI Filter you only have access to the HTTP header. If you need to change any of the response bytes, its SF_NOTIFY_SEND_RAW_DATA the one needed. However, when this notification is signaled, and it may be signaled multiple times, the HTTP Header has already been sent. So, assuming the HTTP response is not in a chunked format, the Content-Length expected by the browser should be same amount of bytes being sent. In other words, only in very rare cases - from the top of my head I can only think of one, like changing the letter casing which does not add/remove any byte - should you need to change the response sent back.

Another alternative is to cache the whole response (headers and payload) in a buffer, change the data needed, update the Content-Length header and finally flush the buffer to the client. However this may turn out to be a performance problem and a potential memory usage issue.

That said, it may be a good time to evaluate the need of doing this, since it may turn out to be a performance issue to every single page.

Hope it helps
Tiago Halm