Tuesday, February 7, 2012

Display files in a directory using ASP.Net.


Display files in a directory using ASP.Net.

This program will print all the files within a specific directory.
  •  file is a string array that content all files.
  •  foreach loop will copy each element within fname string.
  • Within for loop each and every file will print.
  
 protected void Page_Load(object sender, EventArgs e)
    {
        string[] file = Directory.GetFiles("D://user//");
        foreach (string fname in file)
        {
           Response.write (fname);
        }
 
    }

No comments:

Post a Comment