Share via

file exists function on unc path with server name possible?

Dani_S 5,581 Reputation points
2024-08-21T08:19:58.9566667+00:00

Hi,

I'm in net 8, if i have unc path = \servername\domain\myfolde \myfile.xml

Can i used function File.Exists(uncPath)?

Thanks,

Developer technologies | .NET | .NET Multi-platform App UI
Developer technologies | .NET | Other

Answer accepted by question author

Bruce (SqlWork.com) 84,071 Reputation points
2024-08-27T15:47:59.64+00:00

first unc paths are only supported when .net 8 is hosted on windows. second, I don't know what you mean by domain. the unc path syntax is:

\\<servername>\<share name>\<optional path>\<filename>

the sever must define the share, and the calling thread must have read access to the share and file folder or a file not found error is returned.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,456 Reputation points Microsoft External Staff
    2024-08-27T05:48:25.92+00:00

    Hello,

    You cannot use File.Exists in your App to determine if the file exists on the server side. This method can check if the file exists in local.

    You can check whether the file exists on the server side, and then send an HTTP(s) request on the client side (your app) to communicate with server side and then check whether the file exists.

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.