Use the namepsace System.IO
VB.NET
Dim fPath As String = Server.MapPath('orders.xml')
Dim fInfo As New FileInfo(fPath)
Dim strFileInfo As String
If fInfo.Exists Then
strFileInfo = 'Name: ' + fInfo.Name + '<br />'
strFileInfo += 'Location: ' + fInfo.FullName + '<br />'
strFileInfo += 'Created on: ' + fInfo.CreationTime + '<br />'
strFileInfo += 'Extension: ' + fInfo.Extension
Else
strFileInfo = 'The file <b>' + fPath + '</b> was not found.'
End If
Response.Write(strFileInfo)
C#
string fPath = Server.MapPath('orders.xml');
FileInfo fInfo = new FileInfo(fPath);
string strFileInfo ;
if(fInfo.Exists)
{
strFileInfo = 'Name: ' + fInfo.Name + '<br />';
strFileInfo += 'Location: ' + fInfo.FullName + '<br />';
strFileInfo += 'Created on: ' + fInfo.CreationTime + '<br />';
strFileInfo += 'Extension: ' + fInfo.Extension;
}
else
{
strFileInfo = 'The file <b>' + fPath + '</b> was not found.';
}
Response.Write (strFileInfo);
Share with