Reputation: 1965
I am trying to "download" a file using the AxWebbrowser in VB.Net language (though, the answer could be in C#, I don't matter). The browser is already logged in, so I tried to catch the download, but for now the test is done with a PDF and I think it is opened directly in the browser. OK, lets put you in the context.
So, I tried to pass to the browser the URL directly and detect the download and catch the bytes ==> Not able to.
I tried to use a WebClient
which I set the cookies, but it doesn't work. Though, using this and comparing with Chrome, I see the cookies aren't the same (in fact I can highly presume there is one important missing).
So, either why I don't get all the cookies or how could I get the bytes from these files?
Upvotes: 1
Views: 271
Reputation: 1965
I got it!!! Finally thought to search how to "save as" a file and then got it.
https://www.codeproject.com/tips/659004/download-of-file-with-open-save-dialog-box
Using GetGlobalCookies
got me the proper cookies and the file is downloaded correctly using Webclient
. Oh yeah!
-- I removed my duplicate answer to another question. I answered another question by mistake --
Upvotes: 0