读取文件列表

需要引用using System.IO;   

string path = HttpContext.Current.Server.MapPath("/WebApplication1/news/");
   DirectoryInfo fileinfo=new DirectoryInfo(path);
   FileInfo[] filename=fileinfo.GetFiles();
   for(int i=0;i<filename.Length;i++)
   {
    this.Label1.Text+="<a href='news/"+filename[i].Name+"'>"+filename[i].Name+"</a><br>";
   }

posted on 2006-10-17 19:18  感動常在  阅读(516)  评论(0编辑  收藏  举报