c#WebRequest UriFormatException

时间:2013-10-20 02:34:17

标签: c# webrequest

我目前有以下代码,抛出异常:UriFormatException:无效的URI:无法解析授权/主机。在WebRequest.Create行上。我做错了什么?

        var path = "http:/mwo.smurfy-net.de/api/oauth2/token?grant_type=client_credentials&client_id=1&client_secret=2";
        var request = (HttpWebRequest)WebRequest.Create(path);
        request.AllowAutoRedirect = false;
        var response = request.GetResponse();

1 个答案:

答案 0 :(得分:1)

不应该是双斜线:

var path = "http://mwo.smurfy-net.de/api/oauth2/token?grant_type=client_credentials&client_id=1&client_secret=2";