Wednesday, March 28, 2012

Text file

In my table, there is a field which stores the path of a text file (C:\\story.txt).

when i want to retrieve that table with gridview, i want that field will show the all text written in that text file. I mean not the path (C:\\story.txt). Instead it will grab all the text written in that text file. How can i do this?


using (StreamReader stream =newStreamReader(@."c:\story.txt"))

{

string fileContents = stream.ReadToEnd();

}


Plus make sure that ASPNET account as read access to C:/ directory.

HC

0 comments:

Post a Comment