user1077685
user1077685

Reputation:

Windows Forms - VB.NET Check if Network Folder Exists without share access?

Is there a way to check if a (UNIX) network folder exists when the user running the Windows Forms application doesn't have access to that folder?

I'm using the following method, but it seems that since I don't have access to that network folder, .NET thinks it doesn't exist, hence the method always returns false:

Private Function DoesUnixDirectoryExist() As Boolean
        Dim bRet As Boolean = False
        Dim dirInfo As New DirectoryInfo("\\unix\dir\here\")

        Try
            If dirInfo.Exists Then
                bRet = True
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        Return bRet
    End Function

Thanks for your help!

Upvotes: 0

Views: 2579

Answers (1)

jlew
jlew

Reputation: 10591

Generally, it's good security practice to not acknowledge the existence of something unless the requesting party has access rights to it. The file share server (samba?) is most likely just following this principle and you cannot change it if you really have zero access rights.

Upvotes: 3

Related Questions