开发者

change html relative image paths to absolute in httpmodule

开发者 https://www.devze.com 2023-02-04 23:46 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消