ASP 101 - Active Server Pages 101 dir_list.aspx
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
    Sub Page_Load(sender as Object, e as EventArgs)
        Dim strPath As String = "./dir/"
        Dim myDirInfo As DirectoryInfo
        lblPath.Text = strPath
        myDirInfo = New DirectoryInfo(Server.MapPath(strPath))
        dgFileList.DataSource = myDirInfo.GetFiles()
        dgFileList.DataBind()
    End Sub
</script>
<html>
<head>
<title>ASP.NET Directory List Sample</title>
</head>
<body>
<p>
Contents of <strong><asp:Literal id="lblPath" runat="server" /></strong>
</p>
<asp:DataGrid id="dgFileList" runat="server"
    Border                = 5
    BorderColor           = "green"
    CellSpacing           = 0
    CellPadding           = 2
    HeaderStyle-BackColor = "#006600"
    HeaderStyle-ForeColor = "#FFFFFF"
    HeaderStyle-Font-Bold = "True"
    ItemStyle-BackColor   = "#CCFFCC"
    AutoGenerateColumns="False"
    >
    <Columns>
        <asp:HyperLinkColumn DataNavigateUrlField="Name" DataNavigateUrlFormatString="dir/{0}" DataTextField="Name" HeaderText="File Name:" />
        <asp:BoundColumn DataField="Length" HeaderText="File Size (bytes):" ItemStyle-HorizontalAlign="Right" />
        <asp:BoundColumn DataField="LastWriteTime" HeaderText="Date Created:" />
        <asp:BoundColumn DataField="Extension" HeaderText="File Type:" />
    </Columns>
</asp:DataGrid>
<hr />
<p>
Click <a href="http://www.asp101.com/samples/dir_list_aspx.asp">here</a> to read about and download the source code.
</p>
</body>
</html>