![](/img/trans.png)
[英]HtmlAgilityPack in C# showing “A first chance exception of type 'System.UriFormatException' occurred in System.dll”
[英]System.UriFormatException occurred in system.dll
我正在Visual Studio中制作一个.net应用程序,该应用程序使用get请求在runescape Wiki上查找信息。 当我尝试
public string GET(string url)
{
WebRequest wrGetURL;
wrGetURL = WebRequest.Create(url);
wrGetURL.Proxy = WebProxy.GetDefaultProxy();
Stream responseStream;
responseStream = wrGetURL.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(responseStream);
string sLine = "";
int i = 0;
string response = "";
while (sLine != null)
{
i++;
sLine = objReader.ReadLine();
if (sLine != null)
response = response + sLine;
}
return response;
}
当我运行以下代码时:
string response = GET("runescape.wikia.com/api/v1/Articles/AsSimpleJson?id=4115");
我收到错误消息:System.dll中发生了'System.UriFormatException'类型的未处理异常
附加信息:无效的URI:无法确定URI的格式。
是否有人对此有想法?
在GET()中将uri添加为“ http://runescape.wikia.com/api/v1/Articles/AsSimpleJson?id=4115 ”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.