473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Using Streamreader with files in servers

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!

May 7 '06 #1
5 1708

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]
"Ismaelf" <is*****@gmail.com> schreef in bericht
news:11**********************@j33g2000cwa.googlegr oups.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!

May 7 '06 #2
"Ismaelf" <is*****@gmail.com> schrieb:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
May 7 '06 #3
ohh thanks alot, this really helped!

May 8 '06 #4
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

"Ismaelf" <is*****@gmail.com> schreef in bericht
news:11**********************@j33g2000cwa.googlegr oups.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!

May 8 '06 #5
Liz

"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

May 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Macisu | last post by:
Hi I am using the object Stream Reader to read Files. The method ReadLine() does not read the character ñ o Ñ. What Can i do? Helpme please thanks
5
by: Drew Yallop | last post by:
I read an XML file with a stream reader in VB.Net. When I look at the stream reader output in debug mode (by passing cursor over the stream reader object)the format is a perfect replica of the...
3
by: Gaia C via .NET 247 | last post by:
(Type your message here) Hi, I want to open a file to read from and then edit and write the text to another file. I am using StreamReader and StreamWriter for this purpose. The problem is that i...
6
by: syed javid | last post by:
hi all, I am getting an error when i process 1 MB txt file using StreamReader and i am reading char by char using streamReader.Read() method at some point it is throwing an exception...
8
by: WordVBAProgrammer | last post by:
I've been struggling with this for a few days now. It worked originally as plain VB-type strings, but for some reason ceased creating the FileNm. I changed the code to use StringBuilder, but...
3
by: curt.bathras | last post by:
I am trying to open and read a file using the following: BufferedStream stream = new BufferedStream(File.OpenRead(aFilename)); If the file specified by aFilename is being used by another...
4
by: moondaddy | last post by:
I need to edit the text in many files so I'm writing a small routine to do this. First I have a method that loops through all the files in a directory and passes the full file path to another...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.