0

screenshot of text

I want to call this API in C#, same parameter will be passed.

It's working fine on POSTMAN; I just want to call from asp.net Web Form

5
  • What is stopping you? Are you looking for HttpClient ? Commented Jun 23, 2020 at 11:53
  • i don't know how to pass multiple parameters i Commented Jun 23, 2020 at 11:56
  • i wanna cal as it is from code behind/back end Commented Jun 23, 2020 at 11:58
  • 2
    Does this answer your question? How to simulate HTTP POST programmatically in ASP.NET? Commented Jun 23, 2020 at 12:03
  • Please don't paste code as screenshots; copy-and-paste the text instead. It will also benefit those using screen readers or other assistive text functionality in a way that images won't. Commented Jun 24, 2020 at 8:27

1 Answer 1

1

Use that :

var values = new Dictionary<string, string>
{
    { "thing1", "hello" },
    { "thing2", "world" }
};

var content = new FormUrlEncodedContent(values);

var response = await client.PostAsync("http://www.example.com/recepticle.aspx", content);

var responseString = await response.Content.ReadAsStringAsync();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.