-1

I'm creating a windows form application for automating downloading files from corporate site. URL to files are hidden by POST, GET request and URL to them is like

https://domain.com/download.aspx?DocID=1431098

After following the link it brings following dialog:

enter image description here

Is there any way to skip this dialog and save the file to path on client machine?

callmebob
  • 6,128
  • 5
  • 29
  • 46
J.Doe
  • 1
  • 3
  • Would you like to do such activity without informing the user? This is undesired behavior and so is not allowed from server side. You might be able to control it from Web Browser client (if supported in configuration) – Techie Mar 31 '16 at 09:53
  • It is an automation tool. so user won't have to do this manually. The user is informed what will happen if the application starts, it has to go to corporate web site with pointed request # and get all files from this request. The WebBrowser Control is `System.Windows.Forms.WebBrowser` – J.Doe Mar 31 '16 at 11:10

2 Answers2

0

When you follow the link, you are actually launching the default program which opens links i.e your default browser.

The prompt that appears then is a way to ensure that the user knows what file the browser is downloading. You can turn it off from the browser setting. Eg: In chrome, it is Settings>Advanced Settings>Download but I doubt this is what you want to do.

If you are trying to download documents from a corporate URL, you can use C# to download the content as seen in this stackoverflow answer, though you have to make sure that the URL directly points to your desired content and not an intermediate page.

*Update

To get data from a secure domain, try setting the username and password you are logging in to the Corporate Website:

Client.Credentials = new System.Net.NetworkCredential("uname", "pass");

Community
  • 1
  • 1
Mkl Rjv
  • 6,815
  • 5
  • 29
  • 47
  • You're suggesting to do this settings to the default browser and save all files in one directory? The problem is that the direct URL to files is not visible. (please tell me if there is a way to find it out of this dialog or getting it trough the POST/GET process. – J.Doe Mar 31 '16 at 11:12
  • Tried it, but it doesn't work, because of the fact that this isn't web server. Its an web based application and the login page is called by the new session for the client - security barriers. if log in as log in to get the File URL we are back to death circle. – J.Doe Mar 31 '16 at 12:03
-1
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();

insert this code once you clicked download or related button. it will complete your automation process

shiv
  • 1