Asp.net, vb.net, C#.net Resources
Welcome to Asp.net, vb.net, C#.net Resources
Sign in
|
Join
|
Help
in
Files (forum)
FAQs (group)
(Entire Site)
Search
Home
Blogs
Forums
Downloads
Asp.net, vb.net, C#.net Resour...
»
FAQs
»
asp.net Faqs
»
Files
»
Re: How to detect if the string indicating a file-system resource is a file or directory?
How to detect if the string indicating a file-system resource is a file or directory?
Last post 08-30-2006, 12:34 AM by
Webdeveloper
. 1 replies.
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
08-21-2006, 6:52 AM
389
Webdeveloper
Joined on 08-19-2006
Posts 1,589
How to detect if the string indicating a file-system resource is a file or directory?
Reply
Quote
How to detect if the string indicating a file-system resource is a file or directory?
Report abuse
08-30-2006, 12:34 AM
956
in reply to
389
Webdeveloper
Joined on 08-19-2006
Posts 1,589
Re: How to detect if the string indicating a file-system resource is a file or directory?
Reply
Quote
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");
}
Report abuse
Powered by
Megasolutions ltd