Search code examples
asp.netfilterstreamhttpmodule

Stream filter to alter paths of images


I am looking to write a stream filer in a http module that anyalyze the output html of a page, search through the pages html for any images within the page, check if the source of the image has a full path or relative path. If its a relative path, alter it to have a full path. Anyone ever write anything anything like this? Looking for some examples of such?


Solution

  • I suggest to direct use the WebControlAdapter for the img tag and not go by analyse the full page for many reasons.

    Here is an example how you can you this adapter, you can simple change it to just fix the full path: http://www.codeproject.com/KB/web-image/IePngControlAdapter.aspx

    Here is one more example more close to what you ask