https://wwws.ameritrade.com/cgi-bin/apps/u/BalancesAndPositions?mode=download
If I navigate to this page I get a "Save As" dialog box. How can I download the file silently?
I tried this code from an article of your, but I am not sure if it works and where the file (if it is) being downed.
Any help would be appreciated! Thanks!
Dim result As String = ""
Try
Dim proxy As New WebProxy(""http://proxy:80/"", True)
proxy.Credentials = New NetworkCredential("userId", "password", "Domain")
Dim request As WebRequest = WebRequest.Create("https://wwws.ameritrade.com/cgi-bin/apps/u/BalancesAndPositions?mode=download")
request.Proxy = proxy
' Send the 'HttpWebRequest' and wait for response.
Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
Dim stream As System.IO.Stream = response.GetResponseStream()
Dim ec As System.Text.Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim reader As New System.IO.StreamReader(stream, ec)
Dim chars() As Char = New [Char](256)
{}
Dim count As Integer = reader.Read(chars, 0, 256)
While count > 0
Dim str = New [String](chars, 0, 256)
result = result + str
count = reader.Read(chars, 0, 256)
End While
response.Close()
stream.Close()
reader.Close()
Catch exp As Exception
Dim str As String = exp.Message
End Try