WebRequest “HEAD” light weight alternative

后端 未结 3 516
予麋鹿
予麋鹿 2020-12-06 13:21

I recently discovered that the following does not work with certain sites, such as IMDB.com.

class Program
    {
        static void Main(string[] args)
             


        
3条回答
  •  粉色の甜心
    2020-12-06 13:29

    Open the connection yourself with a socket (instead of an HttpRequest or WebClient), and close the stream as soon as you've read the status code. Fortunately the status code comes near the top of the response stream :)

提交回复
热议问题