C# 网页中的内部链接转换为可以爬取的链接
比如这个网站
http://www.sscopper.com/Website/index.asp
有个联系我们的链接
然后,我爬取该链接,他是个内部链接,<a href="cWeb.asp?id=3"><em>联系我们</em></a>
链接取出来就是这样的
cWeb.asp?id=3,这样的链接没办法下载网页
应该怎么处理,才能变成可以下载的链接。
我希望是一个通用的做法
public static string GetPageSource(string URL)
{
Uri uri = new Uri(URL);
HttpWebRequest hwReq = (HttpWebRequest)WebRequest.Create(uri);
HttpWebResponse hwRes = (HttpWebResponse)hwReq.GetResponse();
hwReq.Method = "Get";
hwReq.KeepAlive = false;
StreamReader reader = new StreamReader(hwRes.GetResponseStream(), System.Text.Encoding.GetEncoding("GB2312"));
return reader.ReadToEnd();
}