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.

Reply via email to