下面的代码需要怎么修改才能发送WebRequest
通过指定的 proxy server
和 port number
?
Dim Request As HttpWebRequest = WebRequest.Create(url)
Request.Method = "POST"
Request.ContentType = "application/x-www-form-urlencoded"
Using writer As StreamWriter = New StreamWriter(Request.GetRequestStream())
writer.Write(params)
End Using
最佳答案
使用 MSDN 中的此代码:
Dim myProxy As New WebProxy()
myProxy.Address = New Uri("proxyAddress")
myProxy.Credentials = New NetworkCredential("username", "password")
myWebRequest.Proxy = myProxy
关于.net - 如何通过代理发送 WebRequest?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13447495/