Click here to Skip to main content
15,843,865 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
\WebBrowser Control I managed to log into the website but while navigating to report URL it display "Save Download Dialog" which I want to skip and let it download the report.csv to a specified location.

WebClient In order to skip Save file Dialog I tried DownloadFile() method and it downloads login page instead of the actual report. I also tried to login through WebClient before downloading the file and again no luck. Still it seems to download login page.

I also tried in the combination by passing cookies from WebBrowser Control to WebClient

Your help will be greatly appreciated.
P.S. the website i'm navigating is in asp.net

What I have tried:

I also tried in the combination by passing cookies from WebBrowser Control to WebClient
Posted
Updated 19-Nov-18 0:25am
v2

I have solved this problem in case somebody looking for solution:

Download of file with open/save dialog box[^]
 
Share this answer
 
//try this code, it will press save button from popup and after it will also select //location and it will close popup.

insert this code after download button pressed. it will fire once your popup opened.

Thread th = new Thread(() =>
{
System.Threading.Thread.Sleep(10000);
SendKeys.SendWait("{Tab}");
SendKeys.SendWait("{Tab}");
SendKeys.SendWait("{Tab}");
SendKeys.SendWait("{Enter}");
System.Threading.Thread.Sleep(5000);
SendKeys.SendWait("{Tab}");
SendKeys.SendWait("{Tab}");
SendKeys.SendWait("{Tab}");
SendKeys.SendWait("{Enter}");
});
th.SetApartmentState(ApartmentState.MTA);
th.Start();
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900