ASP.NET Problem with IO.Directory.GetFiles
-
Hi all, I have a problem with that instruction: For Each f In IO.Directory.GetFiles(sDir) sDir = "R:\Temp" for example. When I use that on a local directory on the C:\ driva it works ok, but when I try to use that on the network with a mapped drive (example: R:\Temp) I get the error: System.IO.DirectoryNotFoundException: Could not find a part of the path R:\Temp Can you help me? Thanks!!!!
-
Hi all, I have a problem with that instruction: For Each f In IO.Directory.GetFiles(sDir) sDir = "R:\Temp" for example. When I use that on a local directory on the C:\ driva it works ok, but when I try to use that on the network with a mapped drive (example: R:\Temp) I get the error: System.IO.DirectoryNotFoundException: Could not find a part of the path R:\Temp Can you help me? Thanks!!!!
use complete UNC path rather than your map drive path. IT will solve the problem:rose:
Abhishek Sur
-
use complete UNC path rather than your map drive path. IT will solve the problem:rose:
Abhishek Sur
-
When I use the complete UNC (for example: \\MyServer\Data\xxx\ ) I have a new problem: System.IO.IOException: Logon failure: unknown user name or bad password. Is there any other way of listing the files on a network drive?
-
Finally I solved the logon problem with those lines of code in the web.config It works ok with thw complete UNC. Thanks for your help!!
-
Can you explain your solution with a bit more detail about the changes to the web.config? Thanks, Patrick
Yes, I added this lines of code to the web.config so the denny access message is solved:
<authentication mode="Windows" /> <identity impersonate="true"/>
Now the directories are listed ok in my code:For Each f In IO.Directory.GetFiles(sDir) Dim myList As New ListItem If f.EndsWith(".xls") Then Dim intPosicion As Integer intPosicion = f.LastIndexOf("\") myList.Text = f.Substring(intPosicion + 1) lstPaths1.Items.Add(myList) End If Next
Here I list all the filenames that ends with .xls and put it into a listbox. Did you understand now? Sorry english is not my language..I speak spanish.