C# C# Streams and Data Processing Streaming Data on the Net WebClient

kenwrites
kenwrites
12,890 Points

Problem with "DownloadData" method of WebClient.

Can't figure out why my code's not passing muster with the C# Streams and Data Processing quiz. Complete code should be attached - let me know if it's not showing up for some reason. The relevant lines are:

 using (var webClient = new WebClient())
             {
                 byte[] treehouseBytes = webClient.DownloadData("https://www.teamtreehouse.com/");
             }

This code gets the error:

  Bummer: Did you pass the url "https://www.teamtreehouse.com" into the 'DownloadData' method?

Task 2 of "WebClient" quiz: https://teamtreehouse.com/library/c-streams-and-data-processing/streaming-data-on-the-net/webclient

Program.cs
using System;
using System.IO;
using System.Net;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(GetTreehouseHome());
        }

        public static string GetTreehouseHome()
        {
            string treehouse = "";

            using(var webClient = new WebClient())
            {
                   byte[] treehouseBytes = webClient.DownloadData("https://www.teamtreehouse.com/");
            }

            return treehouse;
        }
    }
}

2 Answers

kenwrites
kenwrites
12,890 Points

Thank you! That was it.