1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to download a file with Awesomium ?

Discussion in 'C, C++, C#' started by foozoor, Jan 10, 2015.

  1. foozoor

    foozoor Newbie

    Joined:
    Nov 16, 2014
    Messages:
    11
    Likes Received:
    0
    I tried a lot of thing to write a function that download a file through the Awesomium SDK in an off screen way.
    Unfortunately, nothing works...

    How to do it with Awesomium 1.7.5 ?

    This is my very basic code...

    Code:
    using System;
    using Awesomium.Core;
    
    namespace AwesomiumTest
    {
        class Program
        {
            public static void Main(String[] args)
            {
                // Download with Awesomium.
                string url = ""; // Sorry I can't provide an URL since I am a new member.
                string filename = "myfile.exe";
                BrowserDownload(url, filename);
            }
    
            public static void BrowserDownload(string url, string filename)
            {
                WebView view = WebCore.CreateWebView(1280, 720);
                view.Source = new Uri(url);
            }
        }
    }
    
    Thanks for your future help. ;)
     
    Last edited: Jan 10, 2015
  2. rootjazz

    rootjazz Jr. VIP Jr. VIP

    Joined:
    Dec 21, 2012
    Messages:
    684
    Likes Received:
    326
    Occupation:
    Developer
    Location:
    UK
    Home Page:
    Why not just use HttpWebRequests?


    Quicker and easier


    Code:
    var wc = new WebClient();
    //for a text file
    var contents = wc.DownloadString("http://thefile.com/url-here");
    
    //byte buffer
    var buffer = wc.DownloadData("http://path.com/goes-here.jpeg");
    
    //download file
    wc.DownloadFile("http://urlhere.com", saveToPath);
    
    This is from memory, so it may not be 100%