Phil
2007-02-06 10:33:01 UTC
I am connecting to a webservice via http but some of our clients use a proxy
server.
The following code worked fine in .Net 1.1 but fails in .Net 2 with the
following error on the line objHTTP.Proxy = objProxy
"Unable to cast object pf type WebProxyWrapper to type System.Net.WebProxy"
The documents say this the correct way and syntax for .Net 2.
Dim objHTTP As HttpWebRequest = CType(WebRequest.Create(objSettings.URL),
HttpWebRequest)
Dim objProxy As System.Net.WebProxy = Nothing
Dim objUri As System.Uri = Nothing
objProxy = New System.Net.WebProxy
objProxy = CType(objHTTP.Proxy, WebProxy)
objUri = New System.Uri("http:\\ProxyIP")
objProxy.Address = objUri
objProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
objHTTP.Proxy = objProxy
Any ideas?
server.
The following code worked fine in .Net 1.1 but fails in .Net 2 with the
following error on the line objHTTP.Proxy = objProxy
"Unable to cast object pf type WebProxyWrapper to type System.Net.WebProxy"
The documents say this the correct way and syntax for .Net 2.
Dim objHTTP As HttpWebRequest = CType(WebRequest.Create(objSettings.URL),
HttpWebRequest)
Dim objProxy As System.Net.WebProxy = Nothing
Dim objUri As System.Uri = Nothing
objProxy = New System.Net.WebProxy
objProxy = CType(objHTTP.Proxy, WebProxy)
objUri = New System.Uri("http:\\ProxyIP")
objProxy.Address = objUri
objProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
objHTTP.Proxy = objProxy
Any ideas?