我在Web服务器上有授权问题。我想发帖请求,但我没有被授权。
以下是我的帖子请求示例:
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https:/test.test/");
var content1 = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("object", "10"),
new KeyValuePair<string, string>("type", "1"),
});
var result1 = client.PostAsync("/api.php?action=someaction", content1).Result;
string resultContent = result1.Content.ReadAsStringAsync().Result;
Console.WriteLine(resultContent);
}
如何在发送此帖子请求之前进行授权?