read and write file

  • Thread starter Thread starter Yahya
  • Start date Start date
Yahya said:
I tried it and I am receiving the attached error. Why could this be
happening?

The file you attempt to download is password protected. The code below will
show you how to pass credentials in a web request:

\\\
Imports System.IO
Imports System.Net
..
..
..
Dim wrq As WebRequest = _
WebRequest.Create("https://example.org/shop/order.jsp")
wrq.Credentials = New NetworkCredential("username", "password")
Dim wrp As WebResponse = wrq.GetResponse()
Dim sr As New StreamReader(wrp.GetResponseStream())
MessageBox.Show(sr.ReadToEnd())
sr.Close()
wrp.Close()
///

Replace the URL, "username" and "password" with appropriate values.
 
Back
Top