Using Streamreader with files in servers

M

Michel Posseth [MCP]

No not with a stream reader , however you could just use a webclient to
retrieve anny file that is server by a webserver
the only thing you need is the web location

regards

Michel Posseth [MCP]
 
L

Liz


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
 

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