// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Net; namespace E { public struct WebInfo { public long size; public DateTime time; } public class WebChecker { public static WebInfo Check(string url) { WebInfo inf = new WebInfo(); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); req.Method = "HEAD"; HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); inf.size = resp.ContentLength; inf.time = resp.LastModified; return inf; } } public class TestClass { private static void Test(string url) { WebInfo inf = WebChecker.Check(url); Console.WriteLine(url + " " + inf.size + " " + inf.time); } public static void Main(string[] args) { Test("http://www.eksperten.dk/img/elogo.png"); Test("http://www.tmk.com/ftp/vms-freeware/fileserv/unzip.zip"); } } }