Checking Whether a File Exists

The highlighted line in Listing 10.1 shows how easy it is to check whether a file exists. If the file does not exist, the code writes the message "The file does not exist." below the File Name field by setting the lblMsg.Text property. If the file does exist, the listing creates a StringBuilder object and builds a string containing the file's attributes, create date, last modified date, and last access date.

You can use the calendar control that appears on the ch10-1.aspx Web Form to change any of the file dates—a task that was nearly impossible to perform cleanly in classic ASP without using an ActiveX control.

Was this article helpful?

0 0

Post a comment