So this is a web app then, correct? Then the files should be in a folder accesible to the web app, not the root of your server.
Do you need help using StreamReader, then?
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
Ok, well, then ignoring all the details about web and shared folders, we'll focus just on StreamReader.
1. Import the correct namespace, which in this case would be: System.IO
2. Define the StreamReader. You can define in combination with its constructor. In C#, for example:
StreamReader sr = new StreamReader("TestFile.txt");
3. Read from it, into a string:
string line;
while ((line = sr.ReadLine()) != null)
{
//Do Something
}
There are lots of variations. One thing I like to do is first create a FileStream object, and point that to my file. This gives me a lot of control over the access method, whether I want to share the file, and so on.
Then, I use a StreamReader constructor that creates a Streamreader from the FileStream.
Notes: Streamreader is buffered, so it's very fast, but you can often get lost in where you THINK the file is positioned, and where it actually IS positioned.
I'm sure you have more questions, just keep asking within this thread.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
ASP.NET or Windows Forms, it doesn't matter. Anything in the .NET Framework can be imported. It's a way of aliasing a namespace. You do it at the top of your program:
C#
using System.IO;
VB.NET
Imports System.IO
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37