Re: FileStream question

"Sean Greer (SBI-Chico)" <[email protected]> Tue, 25 Jun 2002 09:49:18 -0700
Newsgroups gmane.comp.windows.devel.dotnet.general
Message-ID <[email protected]>
What about this:

        WebClient wc = new WebClient();
        byte[] pageData =
wc.DownloadData("http://www.someserver.com/mytestfile.txt");

This has worked for me...

Seang


-----Original Message-----
From: Jeff Roberts [mailto:[email protected]]
Sent: Tuesday, June 25, 2002 8:53 AM
To: [email protected]
Subject: [DOTNET] FileStream question


Does anyone know if I can read a text file from a web server with the
FileStream class ?  For example, if my .net application was launched from
www.ws.com\myapp.exe, could I read a file from www.ws.com by the name of
mytextfile with the following code ?

string Dir = AppDomain.CurrentDomain.BaseDirectory;

file = new FileStream(Dir+"mytextfile",
FileMode.Open,FileAccess.Read,FileShare.ReadWrite);

reader = new BinaryReader(file, Encoding.Unicode);

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.