HTTP GET request and XML answer

前端 未结 1 1644
半阙折子戏
半阙折子戏 2021-01-11 16:36

I am new to C#, I need to send HTTP GET request and read answer. I am familiar with Java and easy can do it URLConnection class but I don\'t know in c#. Can anybody help ?<

相关标签:
1条回答
  • 2021-01-11 17:12

    The simplest way is to use WebClient:

    WebClient client = new WebClient();
    string text = client.DownloadString(url);
    

    (That's the synchronous form; it also supports asynchronous requests.)

    For more control you might want to use HttpWebRequest.

    0 讨论(0)
提交回复
热议问题