Honorable Squid Guru’s
I have no clue how a Proxy Server does what it does. I do how ever need to
authenticate myself programmatically using Visual Basic. So my application
can get past Squid and on to
http://www.federalreserve.gov/releases/h15/update/h15upd.htm. Where I will
read and parse the data from this page.
Please correct me if I am wrong, but so far I am under the impression that
a NTLM patch needs to be applied to squid 2.3 in order to use the Dot Net
Credentials functionality? Can it be applied safely to this version?
My second assumption is that the user name and password is being passed
from my web browser to Squid in the Headers? And if this is correct can I
add my user name and password into the request header? And again if I am
correct, what header value names called for the user name and password that
I need to populate?
Here is a small example of what I have tried so far.
VB60 example
WebBrowser1.Navigate URL:="http://www.google.com",
Headers:="Authorization: Basic " & EncodeBase64("MyUserName", "MyPassword")
& Chr$(13) & Chr$(10)
VB60 Results;
I get the prompt from Squid, to enter user name and password. Which is not
good, because this is going to be running at 2am, and I don't want to be
here to press enter.
VB.Net example
' Retrieves the HTML from the specified URL,
' using a default timeout of 10 seconds
Dim objRequest As Net.WebRequest
Dim objResponse As Net.WebResponse
Dim objStreamReceive As System.IO.Stream
Dim objEncoding As System.Text.Encoding
Dim objStreamRead As System.IO.StreamReader
Try
' proxy settings
Dim pr As New System.Net.WebProxy("MyProxyServerName", 80)
Dim cr As New System.Net.NetworkCredential("MyUserName",
"MyPassword") ' , "MyDomain")
pr.Credentials = cr
objRequest = Net.WebRequest.Create(URL)
objRequest.Proxy = pr
objRequest.Timeout = TimeoutSeconds * 1000
objResponse = objRequest.GetResponse
objStreamReceive = objResponse.GetResponseStream
objEncoding = System.Text.Encoding.GetEncoding( _
"utf-8")
objStreamRead = New System.IO.StreamReader( _
objStreamReceive, objEncoding)
' Set function return value
GetPageHTML2 = objStreamRead.ReadToEnd()
' Check if available, then close response
If Not objResponse Is Nothing Then
objResponse.Close()
End If
Catch ex As Exception
' Error occured grabbing data, simply return nothing
Return ex.ToString
End Try
VB.Net result;
This returned the html source from Squid, that enters the username
and password to change the password, again not good.
Carl Boudreau
Received on Wed Jan 05 2005 - 14:36:27 MST
This archive was generated by hypermail pre-2.1.9 : Mon Mar 07 2005 - 12:59:35 MST