change html relative image paths to absolute in httpmodule
I have set up a .net http module to c开发者_如何学编程apture the html output of a page. I am looking to finding the quickest way to do the following:
Search through all the images (ie. img tags and input controls of type image) Find those that have a relative source path Manipulate the path by converting it from relative to absolute (I pass the absolute path to it) Update the html source Output the manipulated html source to users browser
Any suggestions as to the best way and more performant way of doing this? I am developing in c#.
You may want to have a look at http://htmlagilitypack.codeplex.com, it makes parsing and modifying HTML content really easy without having to resolve to a bunch of RegEx.
精彩评论