Getting files from a mapped directory in ASP.Net
Posted on 2004-09-10
I am trying to retrieve the list of files in the directory " Docs/S000700" which is in the d drive of the W1 computer.
I have mapped the D Drive of the W1 computer to my computer on the S:/
I am using the following code to retrieve the file list in that directory but I am getting path not found error at
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path "S:/Docs/S000700/".
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Const IMAGE_DIRECTORY As String = "S:/Docs/S000700/"
Dim pics As ArrayList = New ArrayList
Dim s As String, html As String
' If Directory.Exists(Server.MapPath(IMAGE_DIRECTORY)) Then
For Each s In Directory.GetFiles("S:/Docs/S000700/", "*.*")
html = "<a href=""" & IMAGE_DIRECTORY & Path.GetFileName(s) & """>" & _
"<p> """ & Path.GetFileName(s) & """ </p>" & _
dlPictures.DataSource = pics
' End If
If I copy the Docs/S000700 folder to the C: of my computer and modify the following lines the code runs fine and it displays the list
For Each s In Directory.GetFiles("C:/Docs/S000700/", "*.*")
Do I have to use a different syntax when retrieving files from a mapped directory???