Proxy authentification

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
 
A

alien2_51

There is a Credentials property for the web request object, use this to add
authentication information for the request.
 
T

Te-Deum

Hi and thanks,

How could i use this method ?
Could you give me an example ?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top