Then this: Private Function ReturnTextFromURL(ByVal url As String) As String Dim retVal As String = "" Try Dim request As WebRequest = WebRequest.Create(url) Using response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse) Using dataStream As Stream = response.GetResponseStream Using reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() retVal = responseFromServer End Using End Using End Using Catch ex As Exception retVal = "" End Try Return retVal End Function First your need two imports statements: Imports System.IOImports System.Net I don't know if this will work or not - but it might be worth a try. So any suggestion to get file from actual host followed by rLink? Just figured out that both rLink and the location from where the file is actually coming out are different.ĭim rLink = curElement.GetAttribute("href").ToString()Dim myWebClient As New WebClient()(HttpRequestHeader.Cookie, )myWebClient.DownloadFile(rLink, "report.csv") As I am already logged in, webbrowser has session data and the reason why following code doesn't work is that I get indirect ![]() You are correct but they don't allow to download reports unless user is logged in and unfortunately they don't provide an API for it.
0 Comments
Leave a Reply. |