calling an http url from a .net console application?

后端 未结 3 1332
醉梦人生
醉梦人生 2020-12-21 04:55

Is it possible to call an http url from a .net console application? can anyone give an idea.?

相关标签:
3条回答
  • 2020-12-21 05:36
    public string DownloadUrl(string url)
    {
        return new System.Net.WebClient().DownloadString(url);
    }
    
    0 讨论(0)
  • 2020-12-21 05:47

    Yes, its possible. Use the WebClient class. See a tutorial here http://www.dotnetperls.com/webclient

    0 讨论(0)
  • 2020-12-21 05:57

    Here is a nice example if you are trying to fetch HTML from a web page using HTTP.

    UPDATE: As you have posted in comment that only thing you expect in response is a string would be good to use WebClient as Chris Fulstow says in his answer.

    System.Net.WebClient().DownloadString(url)
    
    0 讨论(0)
提交回复
热议问题