Fetching data from the web with C#, the easy way (1-liner)

I don’t know why the top results from Google always involve more than 10 lines of code and loads of comments when actually you can just do this:

byte[] Data = new WebClient().DownloadData(FrameURL);

You can try DownloadString and DownloadFile based on your requirements

Load data into controls in asp.net

Usually when working on windows form, I use this to do the work

        DropDownList1.DataSource = new ApplicationTableAdapter().GetDataBySystemID(1);
        DropDownList1.DataTextField = "Name";
        DropDownList1.DataValueField = "ID";

But surprisingly, when switched to ASP.NET, the above code no longer works, at first I thought it was a problem with the paradigm so I tried to store the data as a session variable but that didn’t work either, until I tried this

        DropDownList1.DataSource = new ApplicationTableAdapter().GetDataBySystemID(1);
        DropDownList1.DataTextField = "Name";
        DropDownList1.DataValueField = "ID";
        DropDownList1.DataBind();

One extra line.