Hi All
(me again!) lol
Anyway, this is where I have got to, and now I'm stuck.
I use a webbrowser to navigate to a site and log in. The site that I navigate to is actually the link to the download but you have got to login first and once you click submit on the login form it then starts the download.
So where I get to is logging in, but I get the IE File download dialog "Open, Save or Cancel".
What I want to do is to be able to download and save this file in the directory of the application all in the background, without the user having to interact with anything.
The file is always a excel file (.xls)
If anyone could shed some light on this.
Mega Thanks in Advance
Alex
(me again!) lol
Anyway, this is where I have got to, and now I'm stuck.
I use a webbrowser to navigate to a site and log in. The site that I navigate to is actually the link to the download but you have got to login first and once you click submit on the login form it then starts the download.
So where I get to is logging in, but I get the IE File download dialog "Open, Save or Cancel".
What I want to do is to be able to download and save this file in the directory of the application all in the background, without the user having to interact with anything.
The file is always a excel file (.xls)
vb.net Code:
Private Sub btnDownload_Click(sender As System.Object, e As System.EventArgs) Handles btnDownload.Click Dim Tday, TMonth, TYear, TDate As String Tday = Date.Now.Day TMonth = Date.Now.Month TYear = Date.Now.Year Tday.Replace("0", "") TMonth.Replace("0", "") TDate = (Tday & "." & TMonth & "." & TYear) Webaddress = (Website Address) WebBrowser1.Navigate(Webaddress) Timer1.Start() End Sub Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete Application.DoEvents() Loop If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then btnlogin.PerformClick() Timer1.Stop() End If End Sub Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click WebBrowser1.Document.All("ssousername").InnerText = "Username" WebBrowser1.Document.All("password").InnerText = "Password" Dim theElementCollection As HtmlElementCollection theElementCollection = WebBrowser1.Document.GetElementsByTagName("input") For Each curElement As HtmlElement In theElementCollection If curElement.GetAttribute("value").Equals("Login") Then curElement.InvokeMember("click") End If Next End Sub
If anyone could shed some light on this.
Mega Thanks in Advance
Alex