performing http methods using windows application in c#

谁都会走 提交于 2019-12-01 23:25:36

You should use System.Net.WebClient.

You can use it to make a request with any method and headers that you'd like, and get the resulting page with a simple stream read.

There's a simple example on the MSDN page, but some sample code for using it might look like:

WebClient webclient= new WebClient();

using (StreamReader reader = new StreamReader(webclient.OpenRead("http://www.google.com")))
{
        string result = reader.ReadToEnd();
         // Parse web page here
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!