【问题标题】:System.UriFormatException occurred in system.dll在 system.dll 中发生 System.UriFormatException
【发布时间】:2015-09-02 04:39:05
【问题描述】:

我正在 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 的格式。

有人知道该怎么做吗?

【问题讨论】:

标签: c# get


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多