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

Proxy authentification

P: n/a
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


Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
There is a Credentials property for the web request object, use this to add
authentication information for the request.
"Te-Deum" <te*****@wanadoo.fr> wrote in message
news:eL**************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #2

P: n/a
Hi and thanks,

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

Thanks.

"alien2_51" <da********@n.o.s.p.a.m.monacocoach.com> a écrit dans le message
de news:OD**************@TK2MSFTNGP11.phx.gbl...
There is a Credentials property for the web request object, use this to add authentication information for the request.
"Te-Deum" <te*****@wanadoo.fr> wrote in message
news:eL**************@TK2MSFTNGP12.phx.gbl...
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


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.