I'm trying to find the file size of a file on a server. The following code I got from this guy accomplishes that for your own server:
string MyFile = "~/photos/mymug.gif";
FileInfo finfo = new FileInfo(Server.MapPath(MyFile));
long FileInBytes = finfo.Length;
long FileInKB = finfo.Length / 1024;
Response.Write("File Size: " + FileInBytes.ToString() +
" bytes (" + FileInKB.ToString() + " KB)");
It works. However, I want to find the filesize of, for example:
string MyFile = "http://www.google.com/intl/en_ALL/images/logo.gif";
FileInfo finfo = new FileInfo(MyFile);
Then I get a pesky error saying URI formats are not supported.
How can I find the file size of Google's logo with ASP.NET?