Proxy authentification

  • Thread starter Thread starter Te-Deum
  • Start date Start date
T

Te-Deum

Hi,

I use this function to download the source of an internet web page,
but if i have a proxy, it doesn't work.
Do you know how i can add a proxy authentification ?

Public Function GetSource(ByVal sURL As String) As String
Try
Dim request As HttpWebRequest = _
CType(WebRequest.Create(sURL), _
HttpWebRequest)
request.AllowAutoRedirect = True
Dim response As HttpWebResponse = _
CType(request.GetResponse(), _
HttpWebResponse)
Dim sr As StreamReader = _
New StreamReader(_
response.GetResponseStream(), _
Encoding.ASCII)
GetSource = sr.ReadToEnd()
Catch
End Try
End Function

Thanks for your help.

Te-Deum
 
There is a Credentials property for the web request object, use this to add
authentication information for the request.
 
Back
Top