Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.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
.net 在azure api中注册外部_.net_Asp.net Mvc - Fatal编程技术网

.net 在azure api中注册外部

.net 在azure api中注册外部,.net,asp.net-mvc,.net,Asp.net Mvc,我试图在azure web api中注册外部,但它显示错误 对象: {消息:“此请求的授权已被拒绝。”} 我使用的代码如下: string realm = "api"; HttpRequestMessage request = new HttpRequestMessage(); request.RequestUri = new Uri("https://api-extranet-physmodo.azurewebsites.net/api/Account/RegisterExternal");

我试图在azure web api中注册外部,但它显示错误 对象:

{消息:“此请求的授权已被拒绝。”}

我使用的代码如下:

string realm = "api";
HttpRequestMessage request = new HttpRequestMessage();
request.RequestUri = new Uri("https://api-extranet-physmodo.azurewebsites.net/api/Account/RegisterExternal");
request.Method = HttpMethod.Post;
HttpClient client = new HttpClient();
AuthToken.connectHTTP();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AuthToken.PhysmodoToken.access_token.ToString());
HttpResponseMessage response = await client.PostAsync(request.RequestUri, content);
response.Headers.WwwAuthenticate.Add(new AuthenticationHeaderValue("Basic", "realm=\"" + realm + "\""));
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
return await response.Content.ReadAsStringAsync();
如何在此api中注册外部