WebRequest an automatic configuration script

c3b12

Newcomer
Joined
Aug 30, 2004
Messages
5
Can somebody help me on this issue?

How to download a file with WebRequest and GetResponse when your are using (compagny security policy) an automatic configuration script (http://xxxx.yy:8080/cfg) to access Internet.

(It works with the Wininet API functions but I'm looking for managed code)
 
PlausiblyDamp said:
Are you trying to download a specific file or just the ability to download any file from the internet?
The tool I'm writing must have the ability to download any file from the Internet and save it.
 
PlausiblyDamp said:
Have you looked at the WebClient class?
Visual Basic:
Dim w As New System.Net.WebClient
w.DownloadFile(<url to downlaod from>, <path to save to>)

Yes I've tried this. Here is my original code:

Dim hwrRequête As HttpWebRequest
Dim hwrRéponse As HttpWebResponse
Dim hwrFlux As Stream
Dim fsrFlux As FileStream
Dim octTampon(999) As Byte
Dim intLecture As Integer

fsrFlux = New FileStream(m_strFichierCible, FileMode.Create)
hwrRequête = CType(WebRequest.Create(m_strURL), HttpWebRequest)
hwrRéponse = CType(hwrRequête.GetResponse, HttpWebResponse)
hwrFlux = hwrRequête.GetResponse.GetResponseStream

Do
intLecture = hwrFlux.Read(octTampon, 0, 1000)
fsrFlux.Write(octTampon, 0, intLecture)
Loop Until intLecture = 0

If Not hwrFlux Is Nothing Then hwrFlux.Close()
If Not fsrFlux Is Nothing Then fsrFlux.Close()​

I now know that I have a Proxy to go through. The exception message I got is the following:

"The underlying connection was closed: the remote name could not be resolved"

My pb is that I don't know the name of the proxy. Instead I have to support an automatic configuration script. If I read the Internet Lan Settings, I have:
http://xxxx.yy:8080/cfg as the script.
 
Back
Top