HEAD与Web客户端? [英] HEAD with WebClient?

查看:126
本文介绍了HEAD与Web客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要承担的答案是否定的,但是.... 有没有一种方法来使用Web客户端发送HEAD方法,并返回标题字符串或类似的东西?

I am going to assume the answer is no but.... Is there a way to use WebClient to send the HEAD method and return the headers as a string or something similar?

推荐答案

您是对的Web客户端不支持这一点。您可以使用HttpWebRequest和设置方法磁头如果你想要这个功能:

You are right WebClient does not support this. You can use HttpWebRequest and set the method to HEAD if you want this functionality:

System.Net.WebRequest request = System.Net.WebRequest.Create(uri);
request.Method = "HEAD";
request.GetResponse();

这篇关于HEAD与Web客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆