2

Hello i have a folder on a network that i can access via SMB. I can connect through a linux bash using Samba SMB Client using:

smbclient [IP] -U [user] --i am required to enter password and then i have access. I can then access the path.

I am trying to access the remote folder via a ASP NET Core 3.1 application hosted on linux and it seems i it does not see the folder:

var path="smb//[username]:[password]@\\[IP]\\[Path-to-remote-folder]"
var doesFolderExist=Directory.Exists(path);

I get a false but the folder exists and can be accessed from the bash with smbclient command.

How can i get access to the remote folder via SMB ?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Bercovici Adrian
  • 8,794
  • 17
  • 73
  • 152
  • In other words, you want to access a Windows file share from Linux. On Windows, you just type the path. On Linux, you mount the path. You don't need to run a client to connect in either case – Panagiotis Kanavos Dec 03 '19 at 16:29
  • I just said that i can access the folder with the client to state that the folder exists.I want to know why my `Asp Net Core app` using `System.IO.Directory.Exists()` can't find it.I need my app to access that folder ! – Bercovici Adrian Dec 03 '19 at 17:09
  • And I posted a link to a duplicate question that shows how to *mount* the folder, just like any other network folder, instead of trying one-off access on each request. Or hard-coding the password in the application itself – Panagiotis Kanavos Dec 03 '19 at 17:11
  • 1
    What if I do not want to mount the folder? Why so quick to close this? – CodeScrubber Dec 13 '21 at 22:17

0 Answers0