UNC with dotnet core

Dani_S 3,316 Reputation points
2022-05-03T13:02:23.097+00:00

Hi,
I'm new with UNC with core.
Can you give some libs to work with UNC folder in core?
Thanks in advance,

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,138 questions
0 comments No comments
{count} votes

9 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,101 Reputation points
    2022-05-03T21:04:55.287+00:00

    UNC paths are for windows clients only.

    on MacOs and Linux, remotes are mounted to the filesystem, at any directory level you desire. to access window shares you use smb utilties and mount the share (typically with the mount cli). you can also use auto mount to only mount when in use. once mounted, the share is accessed as any folder.

    on MacOs SMB support is builtin. use "Finder->Go->Connect to Server... " and use the smb: protocol (mounts to /Volumes)

    smb://<servername>/<fileshare path>

    you can also just use the mount cli to mount a smb volume to a mount point, or just: open "smb://<servername>/<fileshare path>" which mounts to /Volumes via finder.

    on Linux, install smb file support (if not installed), and see the instruction for the distro chosen. for example on redhat:

    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_file_systems/mounting-an-smb-share-on-red-hat-enterprise-linux_managing-file-systems

    1 person found this answer helpful.
    0 comments No comments

  2. Bruce (SqlWork.com) 61,101 Reputation points
    2022-05-03T14:36:23.91+00:00
    0 comments No comments

  3. Dani_S 3,316 Reputation points
    2022-05-03T15:04:52.867+00:00

    Thanks for answer,
    How do I connect to UNC folder with credentials using cross platform code ?

    0 comments No comments

  4. Dani_S 3,316 Reputation points
    2022-05-04T08:55:05.613+00:00

    Thanks for your answer,
    Is it possible to connect to UNC folder with credentials using core library in all platforms (Mac && Linux) in C#?

    0 comments No comments

  5. Bruce (SqlWork.com) 61,101 Reputation points
    2022-05-04T14:50:19.643+00:00

    No. To access a UNC share on MacOS or Linux, you need to mount the share into the file system. Once mounted, the share is accessed like any file.

    So before running your program the share need mounting.

    Note: you could probably find a SMB client library that your code could use.

    0 comments No comments