Private Sub btnTest_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnTest.Click
Dim myRequest As System.Net.WebRequest
Dim myResponse As System.Net.WebResponse
Dim myProxy As New System.Net.WebProxy
Cursor.Current = Cursors.WaitCursor
myRequest = System.Net.WebRequest.Create("http://www.ourserver.com")
myRequest.Timeout = 30000
' Obtain the Proxy Prperty of the Default browser.
myProxy = CType(myRequest.Proxy, System.Net.WebProxy)
If Not myProxy.Address Is Nothing Then
MsgBox("The default Proxy address is: " & myProxy.Address.AbsoluteUri)
End If
Dim newUri As New Uri(txtServer.Text)
' Associate the new Uri object to the myProxy object.
myProxy.Address = newUri
' Create a NetworkCredential object and assign to the Credentials property
of the Proxy object.
myProxy.Credentials = New System.Net.NetworkCredential(txtUser.Text,
txtPassword.Text)
myRequest.Proxy = myProxy
Try
myResponse = myRequest.GetResponse()
MsgBox("Connection worked!")
Catch ex As System.Net.WebException
MsgBox("WebException occurred connecting to server: " & ex.Message)
MsgBox("Exception status = " & ex.Status.ToString)
If Not ex.InnerException Is Nothing Then
MsgBox("InnerException.Message = " & ex.InnerException.Message)
End If
If Not ex.Response Is Nothing Then
MsgBox("Status Code: " & CType(ex.Response,
System.Net.HttpWebResponse).StatusCode)
MsgBox("Status Description: " & ("Status Description: " & CType(ex.Response,
System.Net.HttpWebResponse).StatusDescription))
End If
Catch ex As System.Exception
MsgBox("Unable to connect to server: " & ex.Message)
Finally
Cursor.Current = Cursors.Default
End Try
End Sub
I read there is a way to specify the Proxy Server for the .NET Framework in
the machine.config file. Does anyone know if the Compact Framework supports
this and also is there a way to also specify a user and password for the
proxy server in machine.config?
"Mike" <mike...@nospam.msn.com> wrote in message
news:%233uo18$9DHA...@TK2MSFTNGP09.phx.gbl...
"Mike" <mike...@nospam.msn.com> wrote in message
news:OXW%23PmM%23DHA...@TK2MSFTNGP09.phx.gbl...
http://www.proxyplus.cz/
I'm using Proxy+ 3.00 (Build #232)
"Mike" <mike...@nospam.msn.com> wrote in message
news:%23hPlGb7%23DHA...@TK2MSFTNGP09.phx.gbl...