手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >.net中mshtml处理html的方法
.net中mshtml处理html的方法
摘要:1.添加引用.net引用Microsoft.mshtmlWebClientwc=newWebClient();wc.Encoding=Enc...

1.添加引用.net 引用Microsoft.mshtml

WebClient wc = new WebClient();

wc.Encoding = Encoding.UTF8;

string str = wc.DownloadString(@"http://www.jb51.net/web/73969.html");

HTMLDocumentClass doc = new HTMLDocumentClass();//获取html对象

doc.designMode = "on"; //不让解析引擎去尝试运行javascript

doc.IHTMLDocument2_write(str);把html 文档写入html对象中

doc.close();关闭写流

Console.WriteLine(doc.title);输出标题

Console.WriteLine(doc.body.innerText); 输出body

Console.ReadKey();

【.net中mshtml处理html的方法】相关文章:

asp.net中eval不能定义变量的问题的解决方法

Asp.net中防止用户多次登录的方法

asp.net中使用cookie传递参数的方法

asp.net下URL处理两个小工具方法

ASP.net中md5加密码的方法

ewebeditor在.net的使用方法

vb.net将图片导入到excel的方法

ASP.Net下载大文件的实现方法

asp.net下linkbutton的前后台使用方法

.Net消息队列的使用方法

精品推荐
分类导航