Set custom Http Proxy over the TCP/IP Connection
Suppose that we want to connect to server with proxy="scs.msg.yahoo.com"
, port="5050"
, so we are using the internet connection with HTTP proxy like below :
Proxy : 192.168.4.10
Port : 8008
Username : username
Password : 开发者_高级运维password
Now, how can i connect to my supposed server with TcpClient ? I wanna set Http proxy in my code and do not want to set it directly by changing Lan Settings in IE
According to this post, it cannot be done without some additional code. The top rated answer gives a link to an open source, 3rd party implementation.
You just need to make a tcp connection to your proxy server. you have to make a http message on your own and set authentication header fields. so at first you have to know which authentication scheme does your proxy server use. by the way, you can use HttpWebRequest and HttpWebResponse classes to handle http messages and also use proxy server.
精彩评论