for (int i=300;i<=500;i++)
{
string StrUrl="http://www.*.com/read.asp?id="+i.ToString()+"";
System.Object MyObject="";
this.axWebBrowser1.Navigate(StrUrl,ref MyObject,ref MyObject,ref MyObject,ref MyObject);
mshtml.HTMLDocumentClass doc =(mshtml.HTMLDocumentClass)axWebBrowser1.Document;
IHTMLDocument2 HTMLDocument = (IHTMLDocument2) axWebBrowser1.Document;
string source=HTMLDocument.body.outerHTML;
string pathd="read.txt";
FileStream sb=new FileStream(pathd,FileMode.Append,FileAccess.Write);
StreamWriter sw=new StreamWriter(sb);
sw.Write(source+"\r\n");
sw.Close();
}
为什么取到的html代码只有http://www.*.com/i.asp?id=300这一个页面的源代码
取循环下去的url都没取到代码
是怎么回事啊`
我看了下循环是执行了
但好象axWebBrowser没有去访问那么多web页 是怎么回事呢
{
string StrUrl="http://www.*.com/read.asp?id="+i.ToString()+"";
System.Object MyObject="";
this.axWebBrowser1.Navigate(StrUrl,ref MyObject,ref MyObject,ref MyObject,ref MyObject);
mshtml.HTMLDocumentClass doc =(mshtml.HTMLDocumentClass)axWebBrowser1.Document;
IHTMLDocument2 HTMLDocument = (IHTMLDocument2) axWebBrowser1.Document;
string source=HTMLDocument.body.outerHTML;
string pathd="read.txt";
FileStream sb=new FileStream(pathd,FileMode.Append,FileAccess.Write);
StreamWriter sw=new StreamWriter(sb);
sw.Write(source+"\r\n");
sw.Close();
}
为什么取到的html代码只有http://www.*.com/i.asp?id=300这一个页面的源代码
取循环下去的url都没取到代码
是怎么回事啊`
我看了下循环是执行了
但好象axWebBrowser没有去访问那么多web页 是怎么回事呢
http://community.csdn.net/Expert/TopicView.asp?id=4066881
中的HttpWebRequest的方法,
axWebBrowser还会下在图片等,不如上面的方法好
而axWebBrowser能~
可以用HttpWebRequest.Credentials来实现身份验证
http://msdn.microsoft.com/library/CHS/cpref/html/frlrfSystemNetHttpWebRequestClassCredentialsTopic.asp
还有我前面给的那个帖子
我现在没空调试
想和fancyf(凡瑞)交个朋友 不知道可否告知MSN或QQ
{
Console.WriteLine("{0:d5}", i);
}