<%@ Page Language="C#" %>
<%@ import Namespace="System.IO" %>
<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
String[] FileCollection;
FileInfo FileInfo;
int i;
FileCollection = Directory.GetFiles(@"C:\WINNT","*.exe");
for (i=0; i < FileCollection.Length; i++)
{
FileInfo = new FileInfo(FileCollection[i]);
FileListBox.Items.Add(new ListItem(FileInfo.Name.ToString()));
}
}
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
EXE Files in Folder C:\WINNT:
<asp:ListBox id="FileListBox" Runat="Server" />
</form>
</body>
</html>
|