- 关 键 词:
- html
| private static string ConvertToAbsoluteUrls (string html, Uri relativeLocation) { IHTMLDocument2 doc = new HTMLDocumentClass (); doc.write (new object [] { html }); doc.close (); foreach (IHTMLAnchorElement anchor in doc.links) { IHTMLElement element = (IHTMLElement)anchor; string href = (string)element.getAttribute ("href", 2); if (href != null) { Uri addr = new Uri (relativeLocation, href); anchor.href = addr.AbsoluteUri; } } foreach (IHTMLImgElement image in doc.images) { IHTMLElement element = (IHTMLElement)image; string src = (string)element.getAttribute ("src", 2); if (src != null) { Uri addr = new Uri (relativeLocation, src); image.src = addr.AbsoluteUri; } } string ret = doc.body.innerHTML; return ret; } |
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- 如何用C#实现依赖注入? (0次浏览)
- C# 实现注销、关机、重启电脑功能 (0次浏览)
- c#中获取存储过程方法 (0次浏览)
- Windows Shell开发:浏览一个文件夹 (0次浏览)
- Windows Shell编程系列 - 获取图标 (0次浏览)
- Windows Shell 开发:从“桌面”开始展开 (0次浏览)
- 实验分析C#中三种计时器使用异同点 (0次浏览)
- C#调用QTP自动化对象模型的实例 (0次浏览)
- 利用 C# 实现任务栏通知窗口 (0次浏览)
- 深入C#学习系列之不可小瞧的using关键字 (0次浏览)



