问题 I have a requirement to verify that a user-specified URL is to an image. So really I need a way to determine that a URL string points to a valid image. How can I do this in .NET? 回答1: You can't do that without downloading the file (at least a part of it). Use a WebClient to fetch the URL and try creating a new Bitmap from the returned byte[] . If it was successful, it's really an image. Otherwise, it will throw an exception somewhere in the process. By the way, you can issue a HEAD request