-2

I currently have an Awesomium Webvcontrol in my WinForms application. When I click a download link it prompts with a save file dialog.

I need it to download the file to a preset location and automatically open it. I am using the latest version of Awesomium.

References:

using Awesomium.Windows.Forms;
using Awesomium.Core;

Has anyone an idea how to make the control point to a preset location?

Quality Catalyst
  • 6,531
  • 8
  • 38
  • 62

1 Answers1

0

I managed to figure a way around this. I added an method to the download event of webcore.

Awesomium.Core.WebCore.Download += onDownload;

The method looks like this.

public static void onDownload(Object sender, DownloadEventArgs e)
{       

    e.Handled = true;       

    using (WebClient Client = new WebClient())
    {
            FileInfo file = new FileInfo("Your Path"); 
            //replace Your Path with the path you wish to save the file including filename and extension

            Client.DownloadFile(e.Url.ToString(), file.FullName);
            //System.Windows.Forms.MessageBox.Show("Downloaded!");

            Process.Start(file.FullName);

    }               
}

This now downloads and opens the file. In my case it was a .exe application.