You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace CPCBILLSYS
{
public partial class DownLoadTool : System.Web.UI.Page
{
private static string folderPath = HttpContext.Current.Server.MapPath("DownFiles");
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserID"] == null)
{
Response.Write("<script>alert('用户登陆已失效!');window.location.href='../Default.aspx'</script>");
return;
}
List<object> data = new List<object>();
DirectoryInfo dirTemp = new DirectoryInfo(folderPath);
dirTemp.GetFileSystemInfos();
foreach (FileSystemInfo fsiTemp in dirTemp.GetFileSystemInfos())
{
if (fsiTemp is FileInfo)
{
FileInfo fi = (FileInfo)fsiTemp;
//if (fi.Extension == ".exe")
//{
data.Add(new { ToolName = fi.Name, FileName = "DownFiles" });
//}
}
}
stTool.DataSource = data;
stTool.DataBind();
}
}
}