calling an http url from a .net console application?

偶尔善良 提交于 2019-11-28 08:29:26

问题


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


回答1:


public string DownloadUrl(string url)
{
    return new System.Net.WebClient().DownloadString(url);
}



回答2:


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)



回答3:


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



来源:https://stackoverflow.com/questions/8441595/calling-an-http-url-from-a-net-console-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!