C# http请求挂代理
想看数据包。如果直接fullUrl = "代理地址";var conent = new System.Net.WebClient().DownloadString(fullUrl);
此时抓包软件报错
通过以下软件设置设置代理后
public static void SendPassword(string password)
{
string targetURL = "http://192.168.0.101:8080/info=";
//设置代理账号密码
var cre = new NetworkCredential("", "");
//设置代理
var proxy = new WebProxy("127.0.0.1", 8080) { Credentials = cre };
if (proxy == null) return;
var client = new WebClient();
string info = computerName + "-" + userName + " " + password;
var fullUrl = targetURL + info;
client.Proxy = proxy;
string reply = client.DownloadString(fullUrl);
Console.WriteLine(reply);
}
可见数据包