Click here to Skip to main content
12,945,437 members (48,519 online)
Rate this:
Please Sign up or sign in to vote.
I have a number business users who regularly download reports from a vendor website. I'd like to automate this process for them using a VB.NET or C# form.

It looks like the vendor has gone out of their way to make this difficult for me. Upon entering the website, the user needs to enter their username and password via a HTTPS form. The rest of the site is HTTPS. They then need to navigate thru a few different pages, which set up session variables (cookies) necessary for the report request. The reports are finally returned from HTTP POST requests which take a bucketload of different parameters. There is also embedded JS which sets up some of these parameters before the form is posted.

I've played with a number of different options, but have finally opted for using the WebBrowser control to navigate thru the site as if I were a normal user. This allows me to ignore the convoluted logic involved in formatting up the final POST request, and also (somewhat) future proofs my code from changes the vendor might make to their website.

So far, so good.

When the form is POSTed, two dialog boxes are displayed; a "File Download" (showing Open, Save and Cancel buttons) and then, if you click Save, a "Save As" dialog. Using an modified version of BimJeam's excellent article (Suppressing Hosted WebBrowser Control Dialogs), I can intercept and click Save on the "File Download" dialog. My problem is, I can't work out how to intercept the "Save As" dialog. It doesn't seem to fire the WM_INITDIALOG message, and doesn't appear in the message queue with any expected name.

Has anyone done this before, or know a good way to approach it?

Thanks in advance.
Posted 6-Aug-12 17:11pm
Updated 6-Aug-12 17:59pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Ok, as a work around I'm polling
every 50ms for a dialog with the title "Save As" and interacting with it when it appears. This works, but I do get the dialog visibly flashing up and then disappearing, which is not ideal.

Hopefully a better solution will appear...
pparya27 6-Dec-16 12:51pm
Hi! I am also stuck in a similar problem, can you please share the code of polling evry 50ms for dialog with title "save as".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,899
CHill60 3,170
Maciej Los 2,443
Jochen Arndt 1,910
ppolymorphe 1,775

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 10 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100