1

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
Deanna
  • 23,876
  • 7
  • 71
  • 156
0xAB1E
  • 721
  • 10
  • 27
  • The very fact you're getting that error suggests it IS using the proxy. You just need to pass the correct credentials through. – Deanna Jun 03 '13 at 16:34

2 Answers2

2

Try this...

request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials
Ciarán
  • 3,017
  • 1
  • 16
  • 20
1

You can also use app.config.

From https://stackoverflow.com/a/8180854/239408

<system.net>
  <defaultProxy useDefaultCredentials="true" />
</system.net>
Community
  • 1
  • 1
xverges
  • 4,608
  • 1
  • 39
  • 60