"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eJ*************@TK2MSFTNGP05.phx.gbl...
hello!, is there any way that streamreader can be used to read a file
published in a web server, ex: "http://localhost/text.txt"
or is there any other way of reading such file??
<URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFile>
The code at that URL:
Public Function LoadTextFile(ByVal Url As String) As String
Dim Request As WebRequest = WebRequest.Create(Url)
Dim Response As WebResponse = Request.GetResponse()
Dim Reader As New StreamReader(Response.GetResponseStream())
LoadTextFile = Reader.ReadToEnd()
Reader.Close()
Response.Close()
Return LoadTextFile
End Function
works for me .... BUT it's really kind of slow (maybe 5-7 seconds to
retrieve a small file (<1K)) .... whereas retrieving it in the browser is
instantaneous ... I've had this problem before in using WebRequest ... are
there any general suggestions for getting reasonable performance ? things I
should be looking at ?
TIA
L