首页 新闻 赞助 找找看

请教个下载网页的问题

0
悬赏园豆:60 [已解决问题] 解决于 2010-08-06 23:39



using System;
using System.Collections.Generic;
using System.Text;
using DownLoadThemes.Core;
using System.Text.RegularExpressions;
using System.Net;
using System.Web;
using System.IO;

namespace DownLoadThemes
{
class Program
{
static void Main(string[] args)
{

string url = @"http:/www.dp803.com/themes/xd/default.html";


HttpWebRequest myReq
= (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse myResp
= (HttpWebResponse)myReq.GetResponse();
StreamReader myStream
= new StreamReader(myResp.GetResponseStream());
string content = myStream.ReadToEnd();

FileStream nFile
= new FileStream("D://border1.xml", FileMode.CreateNew);
StreamWriter sw
= new StreamWriter(nFile);
sw.WriteLine(content);
sw.Close();
}
}
}

如上

运行时出现:无效的 URI: 未能分析证书颁发机构/主机。 的错误

把网址换成 百度 或者其他的是,可以正常下载,就是不能下载这个网站中的网页,怎么解决?

sjh9的主页 sjh9 | 初学一级 | 园豆:4
提问于:2010-08-06 19:03
< >
分享
最佳答案
0

http: 后面少了一个 /

 

string url = @"http://www.dp803.com/themes/xd/default.html"

收获园豆:60
Launcher | 高人七级 |园豆:45045 | 2010-08-06 20:07
其他回答(3)
0

呵呵,有问题就大声念出来,就会解决。

如“H T T P : / ”,矣,怎么少一个...

Astar | 园豆:40805 (高人七级) | 2010-08-06 20:45
0

“http:/"少了个"/",话说LZ的下载网页代码有点问题,需要设置下编码,否则下载下来会乱码

kyo-yo | 园豆:5587 (大侠五级) | 2010-08-06 21:16
0

嘿嘿,今天我也是,犯了一样的错误

SmallDong | 园豆:75 (初学一级) | 2014-03-28 13:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册