Reading of Text file using ASP.Net
The program will read a text file and output will display in screen. I have used StreamReader class to read text file. And rd is the object of StreamReader class.
- StreamReader class is used to read the content of file.
- ReadToEnd() method of StreamReader class is used to read file upto last character.
protected void Page_Load(object sender, EventArgs e)
StreamReader rd = new StreamReader("D:\\hello.txt");
string val = rd.ReadToEnd();
Post a Comment