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