Hey guys!
Can you please see my code and tell me what's wrong in it? I can't seem to find the problem:
The code above returns the exception picture, but it doesn't get the favicon of the website.Code:public static Image favicon(Uri Url) { try { Uri websiteuri = new Uri(Url.Host); string faviconurl = "http://" + websiteuri + "/favicon.ico"; WebRequest req = WebRequest.Create(faviconurl); WebResponse res = req.GetResponse(); Stream ico = res.GetResponseStream(); return Image.FromStream(ico); } catch (Exception ex) { return Properties.Resources.LargeGlobe; } } private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) { pictureBox5.Image = favicon(webBrowser1.Url); Form1.tabControl1.SelectedTab.Text = webBrowser1.DocumentTitle; }
Need it as soon as possible.
Thanks guys!




Reply With Quote