title: vb.net how to check network drive is mapped
body: <p>I am studying VB.NET and looking for way to check if application mapped to network drive.
  I check
  <a href="https://stackoverflow.com/questions/1585976/vb-net-how-to-check-if-a-network-drive-is-mapped-persistently">vb.net how to check if a network drive is mapped persistently</a></p>
  <p>and i also trying to ping to network drive. However, this method seem not workinng.</p>
  <p>I  was trying ping to  network drive  and it was always return false.</p>
  <p>I made function.
  On the function part</p>
  <pre><code>    Public Function CheckForInternetConnection(path As String) As Boolean
          Try
              Using client = New WebClient()
  
                  Using stream = client.OpenRead(path)
                      Return True
                  End Using
              End Using
          Catch
              Return False
          End Try
      End Function
  </code></pre>
  <p>On the running part i call this function above</p>
  <pre><code>CheckForInternetConnection(&quot;google.com&quot;)
  CheckForInternetConnection(&quot;\\mynetowrk_Driver.com\system\application&quot;)
  </code></pre>
  <p>When i use CheckForInternetConnection with &quot;google.com&quot; it return &quot;TRUE&quot;
  However, when i use &quot;\mynetowrk_Driver.com\system\application&quot;  this network drive, it return <strong>FALSE</strong></p>
  <p>I am not sure how i can check if netowork driver was mapped .</p>