Read File on Remote Server in Hidden Share

Here some code :



 Public Class ShareInfo 
#Region "Code for NETRESOURCE" 
#Region "Constants" 
        'NETRESOURCE 
        Private Const RESOURCE_CONNECTED As Short = &H1S 
        Private Const RESOURCE_GLOBALNET As Short = &H2S 
        Private Const RESOURCE_REMEMBERED As Short = &H3S 
        Private Const RESOURCETYPE_ANY As Short = &H0S 
        Private Const RESOURCETYPE_DISK As Short = &H1S 
        Private Const RESOURCETYPE_PRINT As Short = &H2S 
        Private Const RESOURCEUSAGE_CONNECTABLE As Short = &H1S 
        Private Const RESOURCEUSAGE_CONTAINER As Short = &H2S 
        Private Const RESOURCEDISPLAYTYPE_GENERIC As Short = &H0S 
        Private Const RESOURCEDISPLAYTYPE_DOMAIN As Short = &H1S 
        Private Const RESOURCEDISPLAYTYPE_SERVER As Short = &H2S 
        Private Const RESOURCEDISPLAYTYPE_SHARE As Short = &H3S 
        'dwFlags - WNatAddConnection2 
        Private Const CONNECT_UPDATE_PROFILE As Short = &H1S 
        Private Const CONNECT_INTERACTIVE As Short = &H8S 
        Private Const CONNECT_PROMPT As Short = &H10S 
        Private Const CONNECT_REDIRECT As Short = &H80S 
        'Error Codes 
        Private Const NO_ERROR As Long = 0L 
#End Region 
        Private Structure NETRESOURCE 
            Dim dwScope As Short 
            Dim dwType As Short 
            Dim dwDisplayType As Short 
            Dim dwUsage As Short 
            Dim lpLocalName As String 
            Dim lpRemoteName As String 
            Dim lpComment As String 
            Dim lpProvider As String 
        End Structure 
#Region "DLL Declare Statement" 
        Private Declare Function WNetAddConnection2A Lib "mpr" _ 
        Alias "WNetAddConnection2A" _ 
        (ByRef lpNetResource As NETRESOURCE, _ 
        ByVal lpPassword As String, _ 
        ByVal lpUserName As String, _ 
        ByVal dwFlags As Integer) As Integer 
#End Region 
#End Region 
#Region "Properties" 
        Private UName As String 
        Private Pass As String 
        Private SName As String 
        Private DLetter As String 
        Public Property UserName() As String 
            Get 
                Return UName 
            End Get 
            Set(ByVal Value As String) 
                UName = Trim(Value) 
            End Set 
        End Property 
        Public Property Password() As String 
            Get 
                Return Pass 
            End Get 
            Set(ByVal Value As String) 
                Pass = Trim(Value) 
            End Set 
        End Property 
        Public Property Share() As String 
            Get 
                Return SName 
            End Get 
            Set(ByVal Value As String) 
                SName = Trim(Value) 
            End Set 
        End Property 
        Public Property DriveLetter() As String 
            Get 
                Return DLetter 
            End Get 
            Set(ByVal Value As String) 
                DLetter = Left(Trim(Value), 1) 
            End Set 
        End Property 
#End Region 
        Public Function MapShare() As Boolean 
            If Not Me.Share = Nothing Then 
                Try 
                    Dim NetR As New NETRESOURCE 
                    NetR.dwType = RESOURCETYPE_DISK 
                    NetR.lpLocalName = Me.DriveLetter & ":" 
                    NetR.lpRemoteName = Me.Share 
                    NetR.lpProvider = "" 
                    WNetAddConnection2A(NetR, Me.Password, Me.UserName, CONNECT_REDIRECT) 
                Catch ex As Exception 
                    MsgBox("Error" & vbCrLf & "Message: " & ex.Message & vbCrLf & "Source: " & ex.Source & ex.ToString, MsgBoxStyle.Critical = MsgBoxStyle.OKOnly, "Map Network Drive") 
                End Try 
            Else 
                MsgBox("Please make sure there is a share referenced to first", MsgBoxStyle.Exclamation, "Map Network Share") 
            End If 
        End Function 
    End Class