A while back I needed to download a URL and determine the MIME type. Fortunately many web servers will send the MIME type of the resource back to the client (some browsers even require it).

I ended up with the following code snippet:

var url = "https://unsplash.imgix.net/photo-1423683249427-8ca22bd873e0";

var name = "";
var bytes = new byte[0];
var mimeType = "";

using (WebClient wc = new WebClient())
	name = System.IO.Path.GetFileName(url);
	bytes = wc.DownloadData(url);
	mimeType = wc.ResponseHeaders["content-type"];