This tutorial will show you how to display file properties , such as view create date, last access date, last modify date and file size, using ASP.NET 2.0 and VB.NET.

First, you will need to import the System.IO namespace.The System.IO namespace contains types that allow reading and writing to files and data streams, and types that provide basic file and directory support. Contains the class of FileInfo ,DirectoryInfo and Path.

Use the DirectoryInfo class for typical operations such as copying, moving, renaming, creating, and deleting directories.
Use the FileInfo class for typical operations such as copying, moving, renaming, creating, opening, deleting, and appending to files.
Use the Path class for performs operations on String instances that contain file or directory path information.

We use the buttonDisplay_Click event , the buttonUp_Click event, the listBoxFolders_SelectedIndexChanged event ,and the listBoxFiles_SelectedIndexChanged event to do the work. Then we call DisplayFileInfo() and DisplayFolderList() to enumerating through directories, subdirectories and files.
ButtonDisplay_Click event will display all folders and files under some the path.
ButtonUp_Click event will return parents path of this path.
ListBoxFiles_SelectedIndexChanged event will display all information of chose files.

We then call to display file properties from our ASP.NET coded page.

The front end DisplayFilePropertiesVB.aspx page looks something like this:

The flow for the code behind page is as follows.

Download Source Files