can someone tell me how to get the icon of a webpage. i can get the icon of a webpage and set it as an image but i want to take it and set it as the icon for my application. here is the code to get the icon and set it as a image

Dim url As Uri = New Uri(TextBox1.Text)

            If url.HostNameType = UriHostNameType.Dns Then
                ' Get the URL of the favicon
                ' url.Host will return such string as www.google.com
                Dim iconURL = "http://" & url.Host & "/favicon.ico"
                ' Download the favicon
                Dim request As System.Net.WebRequest = System.Net.HttpWebRequest.Create(iconURL)
                Dim response As System.Net.HttpWebResponse = request.GetResponse()
                Dim stream As System.IO.Stream = response.GetResponseStream()
                Dim favicon = Image.FromStream(stream)
                ' Display the favicon on PictureBox1
                PictureBox1.Image = favicon
            End If
6 Years
Discussion Span
Last Post by choover12

ok i tried

dim favicon = icon.fromstream(stream)

mabye that will work


Add this to your code.

Dim iconBitmap As Bitmap = New Bitmap(favicon)
            Me.Icon = Icon.FromHandle(iconBitmap.GetHicon)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.