Live Chat Icon For mobile
Live Chat Icon

How to detect if the string indicating a file-system resource is a file or directory

Platform: ASP.NET| Category: Files


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')
   	Response.Write('Its a file')
End If


string path =Server.MapPath ('webform1.aspx');
if ((File.GetAttributes(path) & FileAttributes.Directory) ==FileAttributes.Directory)
	Response.Write ('Its a directory');
	Response.Write ('Its a file');

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.