When I use:
response = (HttpWebResponse)req.GetResponse();
it will respond with the package content of the entire HTML from the webpage. But I only want to get the header of the webpage. Can I set a limit for response content length?
Thanks you!
If you just need HTTP header - use HEAD request instead of GET. If you need some part of a web page it may be easier to read whole response unless you know what part of it you need. You can either read part of response stream or use range - HttpWebRequest.AddRange.