I'm trying to make a program to download a file from the internet.

it compiles fine.

but when i press the button to start the download comes up with this

An exception occurred during a WebClient request.

heres the source code to it

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            WebClient Client = new WebClient();
            Client.DownloadFile("http://wiibrew.org/w/images/c/cf/Lsusb.tar.bz2", "C:\\Users\\Skull\\Desktop");
        }
    }
}

Recommended Answers

All 3 Replies

You need to specify the download location. That means instead:
"C:\\Users\\Skull\\Desktop" you need to put "C:\\Users\\Skull\\Desktop\\Lsusb.tar.bz2".

Here's the documentation:
http://msdn.microsoft.com/en-us/library/ez801hhe(v=VS.100).aspx

it works now without errors. But it doesn't save it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.