|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using Streamreader with files in servershello!, 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??, thanks! 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] Show quoteHide quote "Ismaelf" <isma***@gmail.com> schreef in bericht news:1147023511.888857.144860@j33g2000cwa.googlegroups.com... > 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??, thanks! > "Ismaelf" <isma***@gmail.com> schrieb: <URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFile>> 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?? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message The code at that URL:news:eJQAMhgcGHA.724@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> 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 IsMaelf,
In my opinion is the most way to use the webclient.downloadfile http://msdn2.microsoft.com/en-us/library/ms144194.aspx I hope this helps, Cor Show quoteHide quote "Ismaelf" <isma***@gmail.com> schreef in bericht news:1147023511.888857.144860@j33g2000cwa.googlegroups.com... > 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??, thanks! >
Count Instances Of String Within String
Large text file import: MVP question Clearing a custom array 'OpenFileDialog crashes for no reason? Removing array entry so cumbersome?? Declaring a garbage collector SMTP won't send until thread terminates regular expressions Which one is the Bluetooth DLL? Text into HTML |
|||||||||||||||||||||||