By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

Cannot Authenticate with Proxy Server

P: n/a
I am trying to use HTTPWebRequest from my application, but I cannot seem to
authenticate with my proxy server.

My GetResponse statement fails with an Error 407, "Proxy Authentication
Required". I am trying to use my default windows credentials which are used
by Internet Explorer. I have also manually supplied credentials with no
luck. This code was downloaded from a Microsoft web page.

Here is my code:

Dim strURL As String
strURL = ""

Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(strURL)

'Use default proxy settings from Internet Explorer
wrGETURL.Proxy = WebProxy.GetDefaultProxy()
wrGETURL.Credentials = CredentialCache.DefaultCredentials

Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

Dim objReader As New StreamReader(objStream)
Dim strLine As String = ""
Dim intI As Integer = 0

Do While Not strLine Is Nothing
intI += 1
strLine = objReader.ReadLine
If Not strLine Is Nothing Then
Console.WriteLine("{0}:{1}", intI, strLine)
End If
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.