My effort to retrieve favicon.ico sometimes fails even though it is found. It fails when attempting to convert the stream into a BMP or an Image using FromStream(), with the ArgumentException, or Parameter Invalid. I've tried all kinds of things to manipulate this and I guess I don't know what I'm doing.
When I save the stream to a file (SaveStreamAsIconFile) as *.ico, it appears to be a valid icon (explorer displays it, and the IDE even shows it).
Here is a link that won't work, and also the code I am using to download and convert the stream:
public static Image GetFavIcon (Uri uriIcon)
{
WebClient webClient = new WebClient();
MemoryStream ms = new MemoryStream(webClient.DownloadData(uriIcon));
MiscMethods.SaveStreamAsIconFile(ms, uriIcon.Host);
ms.Position = 0;
Bitmap bmp = new Bitmap(ms);
return bmp;//Image.FromStream(ms);
}