get image and byte size from internet in visual basic .net

Posted on 2014-08-20
Last Modified: 2014-08-20
We have a static image on our website and we use that to check if the site is up.  How could I get the image and byte size using visual basic .net with a url?
Question by:chadmanvb
    LVL 25

    Accepted Solution

    Try this:

    'Download the image to a local path
    My.Computer.Network.DownloadFile("http://...", "localPath")
    'Get the image size
    Dim fileSize As Int64 = New System.IO.FileInfo("localPath").Length

    Open in new window

    Hope that helps.

    Author Comment

    Ohh, looks like that quick question.  How can I have it write over the image if it already exist in my local dir?

    Author Closing Comment

    Worked great.  Just used an overload so I could keep overwriting the file.

    My.Computer.Network.DownloadFile _
        (address := "", _
        destinationFileName := Path.Combine(Environment.GetFolderPath( _
        Environment.SpecialFolder.ApplicationData), _
        "test/randomfile.txt"), _
        userName := string.Empty, password := string.Empty, _
        showUI := False, connectionTimeout := 100000, _
        overwrite := True)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now