php - How to call simple web-service in c# and show response in text-box?


Today is my first day at c#. I want to call simple web-service from c# desktop application. I searched over net but could not found any simple example in this regard. Can anyone please help me to start this job from ABC. I have web-service as echo.php( placed in htdocs folder of xampp)

    echo "Hello";    

and want to call it on button press

private void button1_Click(object sender, EventArgs e)
    //   want to call web-service from here and want to print response in   
    //   any text box.                



There are numerous methods to do this in C#, For your simple example, a WebClient-Call should do what you want.

private void button1_Click(object sender, EventArgs e)
    var client = new WebClient();
    var response = client.DownloadString("http://localhost:8000"); // or whatever your url might look like

    myTextBox.Text = response;

People are also looking for solutions to the problem: php - MySQL query: SELECT particular number of rows starting with today and go backwards


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.