我必须输入www.xyz.ki.com类型的URL的html内容
> I tried this code
using System;
using System.IO;
using System.Net;
class program{
static void Main(string[] args)
{
List<string> paths = new List<string>()
{"https://www.sbi.co.in/careers/ongoing-recruitment.html",
"www.csd.bih.nic.in/Notification.htm"};
foreach (var links in paths)
{
System.Console.WriteLine("..operating on : {0}",links);
WebRequest request = WebRequest.Create(links);
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
System.Console.WriteLine(responseFromServer);
}
}
}
它仅对第一个URL有效,但是当控制权传递给第二个URL时,它会给出错误
“ System.UriFormatException:无效的URI:无法确定URI的格式。