Is there an opportunity to make http get request, read headers and not fetching body in order to reduce traffic and increase speed? I use this code:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(u1);
request.AllowAutoRedirect = true;
request.Timeout = 30000;
request.Method = "GET";
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36";
request.KeepAlive = true;
HttpWebResponse response;
using (response = (HttpWebResponse)request.GetResponse())
{
var res = response.ResponseUri.ToString();
}
So I need only the result url. If there is a redirection (Location header) - I will get the result url. But I don't need the body. Is it real to get response with GET method (not HEAD method) to get the result without the response body?
HEAD
requests. The response body is (at least partially) already on its way with aGET
. You can ignore it, but it still comes and costs unnecessary bandwidth.