How do I to download an embedded image using web browser control of VB.NET, that we can achieve by right clicking on the image and doing ‘save picture as’?
I am developing a VB.NET project that crawls through a particular website and downloads its contents including any images embedded into it. Now my problem is that I can not use a web client and HTTP request/response classes to serve my purpose because of the security that is maintained on the site.
The web site is maintained with some JavaScript and jQuery. Also, it maintains the session through some set of cookies and hidden fields that it tracks on each single URL request. If it finds any discontinuity then it redirects to the login page.
I found the solution to this problem by using a web browser component which is doing great for me in maintaining security.
But my next set of problems is storing of the contents other than an HTML source file like embedded images which is my main concern right now, and I am sure many of the software developers must be facing the same.
I found various post in C# which I modified, but it didn’t work for me, like in C# code for saving an entire web page? (with images/formatting).
Also, I have got a project addressing the same problem in Save image from web-browser control in Visual Basic 2005, but for this my company policies won’t allow me.
How do I automate the procedure of right click and ‘save picture as’?
Is there any real solution? If not, then is there any alternate solution like copying from temp folders. If yes, please provide a solution!
I didn’t get the answer for first approach, that is, downloading with the web browser component, but I got the alternative as copying from the ‘Temporary Internet Files’ Folder.
Here is my code snippet that is doing the job for me.
This is not a proper way for downloading images, but it’s currently doing the job for me.