Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不支持WebRequest return指定的方法Windows Phone 8.1通用应用中请求访问令牌时出错_C#_.net_Windows Runtime_Windows Phone 8.1 - Fatal编程技术网

C# 不支持WebRequest return指定的方法Windows Phone 8.1通用应用中请求访问令牌时出错

C# 不支持WebRequest return指定的方法Windows Phone 8.1通用应用中请求访问令牌时出错,c#,.net,windows-runtime,windows-phone-8.1,C#,.net,Windows Runtime,Windows Phone 8.1,我使用链接尝试了下面的代码 var request = WebRequest.Create(new Uri("https://www.googleapis.com/blogger/v3/token")); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; var url = string.Format("code={0}&client_id={1}&client

我使用链接尝试了下面的代码

var request = WebRequest.Create(new Uri("https://www.googleapis.com/blogger/v3/token"));
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";

var url = string.Format("code={0}&client_id={1}&client_secret={2}&redirect_uri={3}&grant_type=authorization_code",
               "4/GIklj-ft_XXXXXXXXXXXXXXXXXXX", //Code returned from previous request  
               "4XXXXXXXXXXXXX.apps.googleusercontent.com", //Client ID  
               "XXXXXXXXXXXXXXX", //Client secret obtained from google API console  
               "urn:ietf:wg:oauth:2.0:oob" //Your callback page  
               );

UTF8Encoding utfenc = new UTF8Encoding();
byte[] bytes = utfenc.GetBytes(url);
Stream os = null;

// Count bytes to send
os = await request.GetRequestStreamAsync();
os.Write(bytes, 0, bytes.Length);

var response = (HttpWebResponse)await request.GetResponseAsync();