Automating the download of a file
<p>I have a question regarding automating the download of a file via the web-browser in c#. </p>

<p>Pretty much this code right here;</p>

<pre><code>try
{
    HtmlElement downloadlink = webBrowser1.Document.GetElementById("dl_link").All[0];
    webBrowser1.Navigate(downloadlink.GetAttribute("href"));

    textBox1.Clear();
}
catch
{
    MessageBox.Show("The YouTube URL is incorrect. Please try a different YouTube URL.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    textBox1.Clear();
}
</code></pre>

<p>is what activates the download of the file I want. Pretty much, the box of where you want to save pops up, and I would simply want to automate it and make it download into a folder I have under the c:\ drive.</p>

<p>I looked over numerous amounts of code which made the coder input the link (URL) of the file download, but for my case the link (URL) is not technically given, so I was wondering how I would approach this situation and would it be possible to automate it?</p>
