110,970
社区成员
发帖
与我相关
我的任务
分享
Encoding encoding = Encoding.GetEncoding(webBrowser1.Document.Encoding);
string path = "c:\\b.html";
StreamReader sr = new StreamReader(webBrowser1.DocumentStream, encoding);
StreamWriter sw = new StreamWriter(path);
sw.Write(sr.ReadToEnd());
sw.Flush();
sw.Close();
sr.Close();
byte[] _HtmlByte = new byte[webBrowser1.Document.Body.OuterHtml.Length];
webBrowser1.DocumentStream.Position = 0;
webBrowser1.DocumentStream.Read(_HtmlByte, 0, _HtmlByte.Length);
FileStream _FileStream = new FileStream(@"C:\b.html", System.IO.FileMode.Create);
_FileStream.Write(_HtmlByte, 0, _HtmlByte.Length);
_FileStream.Close();