In winformProgram, If it involves access to the network, then consider the proxy situation, it is necessary;. Net program using proxy, is very simple, I have written a http://www.zu14.cn/2008/10/18/csharp_proxy/
It indicates how to specify a proxy for WebClient, httpwebrequest, webrequest, ftpwebrequest, and filewebrequest.
When using IM software such as QQ, MSN, and Baidu Hi, there is usually a proxy setting in network settings. One of the options is"Use a browser to set"
So in our. Net Program, how to use this function is actually very easy!
Starting from. NET Framework 2.0, Microsoft providesWebrequest. getsystemwebproxyThis static method, this methodReturns the proxy configured in Internet Explorer settings of the current simulated user., Usage:
WebClientWC =NewWebClient(); WC. Proxy =Webrequest. Getsystemwebproxy ();HttpwebrequestReq = (Httpwebrequest)Webrequest. Createdefault (NewUri("Http://zu14.cn /"); Req. Proxy =Webrequest. Getsystemwebproxy ();
Is it concise and clear?