HTTP GET Request Difficulty
Okay, i've tried httpwebrequest, webclient, and a couple of others methods; using the headers parameter of each to set headers and then either opening a response stream or simply setting the system.net.webclient method to download a response into a string. No luck!
Put simply, how do I make a simple GET request with a few headers and read the data back! I am very, very stuck in a hole right now.. :ehh:
Re: HTTP GET Request Difficulty
I've got a very simple example here, perhaps it will help you. Click on the 'How to make a web request' link down in my signature.
Re: HTTP GET Request Difficulty
Thanks for your help cicatrix, is this class able to support the sending of header data?
Re: HTTP GET Request Difficulty
You shoud modify it a bit, but yes. Use Webrequest.Headers collection to modify the default header strings.
Usually, you don't even need to do that (if you simply want to get a html page, but if you wish, - use wrq.Headers collection)
Re: HTTP GET Request Difficulty
Quote:
Originally Posted by
cicatrix
You shoud modify it a bit, but yes. Use Webrequest.Headers collection to modify the default header strings.
Usually, you don't even need to do that (if you simply want to get a html page, but if you wish, - use wrq.Headers collection)
Great, thanks. In this case, I am using a REST API and so need to carefully structure my GET headers with API keys / handshake details etc. Thanks for your help!