i'm trying to automate the file download from a web page, the problem is, that web return directly the file. for example, http://www.someweb.com/generatefile.aspx, when i navigate to that page, a file is returning. I tried with WebClient, but didn't work, always give error 500, however if i try through whit IExplorer or Firefox, work well. So, i trying with WebBrowser control, which i made all other things, such as login to web.
WebClient client = new WebClient();
client.DownloadFile(url, "D:/ss.pdf"); //Here error 500
and with WebBrowser
WebBrowser wb = new WebBrowser();
wb.FileDownload += new EventHandler(wb_FileDownload); //in the event handler i not found how save the file
wb.Navigate(url);
Thanks for any help.