Read All Notepad Files in a folder and merge all notepad files DATA in . aspx page

In this article, trying to fetch data more notepad file’s of a folder and merge them on an aspx page. In this sample article 45 notepad files are used, firstly read them and then merge all files and write on a .aspx page. It’s a fast way to assemble all files to in a one webpage. 

In .aspx Page

Firstly add this namespace

On Page Load Event

Write this code on Page load
protected void Page_Load(object sender, EventArgs e)
        DirectoryInfo dirinfo = new DirectoryInfo(Server.MapPath("TXTF/"));
        string validExtensions = "*.txt";
        string[] extFilter = validExtensions.Split(new char[] { ',' });
        ArrayList files = new ArrayList();

        foreach (string extension in extFilter)
                for (int i = 0; i < files.Count; i++)
                    StreamReader fb;
                    string filename = files[i].ToString();
                    fb = File.OpenText(dirinfo +  filename);
                    string input = null;
                    while ((input = fb.ReadLine()) != null)
                     Response.Write(input + "</br>");                                             
                    //return 0;
            catch (Exception ex)
                lblerror.Text = ex.ToString();



My all Notepad files in a TXTF folder. In aspx page you change your Folder name then if u want to fetch only one file so you comment the loop section. But these code works good.