Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.NET Problem with IO.Directory.GetFiles

ASP.NET Problem with IO.Directory.GetFiles

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netsysadmintutorial
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Larvex
    wrote on last edited by
    #1

    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!!!!

    A 1 Reply Last reply
    0
    • L Larvex

      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!!!!

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      use complete UNC path rather than your map drive path. IT will solve the problem:rose:

      Abhishek Sur

      L 1 Reply Last reply
      0
      • A Abhishek Sur

        use complete UNC path rather than your map drive path. IT will solve the problem:rose:

        Abhishek Sur

        L Offline
        L Offline
        Larvex
        wrote on last edited by
        #3

        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?

        L 1 Reply Last reply
        0
        • L Larvex

          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?

          L Offline
          L Offline
          Larvex
          wrote on last edited by
          #4

          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!!

          P 1 Reply Last reply
          0
          • L Larvex

            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!!

            P Offline
            P Offline
            pnslcs
            wrote on last edited by
            #5

            Can you explain your solution with a bit more detail about the changes to the web.config? Thanks, Patrick

            L 1 Reply Last reply
            0
            • P pnslcs

              Can you explain your solution with a bit more detail about the changes to the web.config? Thanks, Patrick

              L Offline
              L Offline
              Larvex
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups