Silently authenticate to a URL via basic auth in C#
<p>I need to build a C# application which accepts a specific URL as input and loads the webpage (which is all text) into a string.  The difficulty is that this URL requires basic authentication in order to load the page.  I need to hard-code the credentials into the app; I can't have the user enter it themselves.  I don't believe it is possible to pass the username &amp; p/w in as part of the URL.  Is there a way to handle this silently with C#?</p>

<p>Here is how, in very basic terms, I would load the page if authentication wasn't required:</p>

<pre><code>static void Main(string[] args)
{
    if (args.Length == 0)
        return;

    WebClient webclient = new WebClient();
    string output = webclient.DownloadString(args[0]);
    Console.WriteLine(output);
}
</code></pre>
