3

I submit form in WebBrowser control this way: WebBrowser1.Document.GetElementById("INS_TASK").InvokeMember("click");

where "INS_TASK" is submit button Id. Form submitted with method POST.

If check traffic by Fiddler there are two requests:

  1. Result 302, method POST
  2. Result 200, method GET

After that "Save file" dialog appears. How to hide this dialog and save downloading file without prompt?

Andrey
  • 497
  • 2
  • 11
  • 25

1 Answers1

0

Only the user can decide to save files without prompt. You can't bypass the save file dialog. This is a browser security feature. If you could tell the browser to skip the save file dialog then anyone could send malicious .exe files that would be saved directly to disk.

Ovidiu
  • 1,407
  • 12
  • 11
  • I think, I can bypass saving dialog. I found samples wich works with WebBrowserNavigatingEventHandler. But in this samples url to file is known ([link]http://stackoverflow.com/questions/6773866/download-file-and-automatically-save-it-to-folder) – Andrey Nov 26 '13 at 10:56
  • WebBrowser class is found in System.Windows.Forms.WebBrowser so I think that's a windows forms application, not a web app. You can use that piece of code but it will download the file on the server, where the application runs, not on the client. – Ovidiu Nov 26 '13 at 11:07
  • 1
    But what I showld do when I don't have link to file? What url I have to put in client.DownloadDataAsync(Url) ? – Andrey Nov 26 '13 at 11:12