i have a problem with authorization on a web server. I want to make a post request, but i am not authorized.
Here is the example of my post request:
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);
}
How can i authorize before sending this post request?
Aucun commentaire:
Enregistrer un commentaire