Able Eldhose Able Eldhose - 2 months ago 17
Vb.net Question

How to set VB Application Proxy Settings to Default System Proxy Settings

My application is supposed to work on a Company Network where proxy is enabled,
By default when logged in all applications like browser and all can access internet normally

But when i open my application "The remote server returned an error [407] Proxy Authentication Required" error is coming

In normal internet connected PC it works well

Is there any way to set manual proxy or more preferably set the system proxy as default to the application
I am too novice in the programming field

My code is

Dim PartURL As String = "http://www.google.com"
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(PartURL)
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim sourcecode As String = sr.ReadToEnd()
SearchPageSource = sourcecode


Also my proxy settings is

Address: abcserver04
Port: 8080


Ipconfig output on cmd prompt is

Ethernet adapter local area connection
Connection Specific DNS Suffix : abc.defgroup.net
IP Address : 10.4.8.xx
Subnet Mask : 255.255.255.0
Default Gateway : 10.4.8.254

Answer

Try this...

request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials