VB.NET
Dim path As String = Server.MapPath('webform1.aspx')
’ Put user code to initialize the page here
If(File.GetAttributes(path) And FileAttributes.Directory) = FileAttributes.Directory Then
Response.Write('Its a directory')
Else
Response.Write('Its a file')
End If
C#
string path =Server.MapPath ('webform1.aspx');
if ((File.GetAttributes(path) & FileAttributes.Directory) ==FileAttributes.Directory)
{
Response.Write ('Its a directory');
}
else
{
Response.Write ('Its a file');
}
Share with