skip to Main Content

I want to access the FTP path and files like – //corp/Test/Test.txt but getting below error.
In c# console(Dot net 6) getting a system.IODirectoryNot found exception ‘C:UsersTest.txt’

above ftp path is being converted into C drive path and giving a error.

please help, Thank you!

2

Answers


  1. What is your code on providing the path? Have you tried verbatim identifier @"c:UsersTest.txt"?

    https://learn.microsoft.com/en-us/dotnet/api/system.io.path?view=net-7.0

    It seems the path has wrong input since ‘C:UsersTest.txt’ is definitely a wrong path.

    Please provide more details

    Login or Signup to reply.
  2. Your path is most likely incorrect. The format the you are specifying it in might be slightly wrong.

    Using string literals should help – these can be used by using the "@" symbol before the string.

    Once you have correctly provided the path, it should work e.g.

    var path = @"//corp/Test/Test.txt";
    File.ReadAllText(path);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search