What is the different between all of these? What is best to use for dealing with a website's API? What's best for logging into websites and such?
Can some one give me the rundown?
Can some one give me the rundown?
|
C#
WebRequest vs HttpWebRequests vs WebClient ?? |
|
Apr 3, 2015 03:36 PM
(This post was last modified: Apr 3, 2015 04:16 PM by Odus.)
The WebRequest class is the base for all requests e.g HTTP, File, FTP. HttpWebRequest's members allow far more control over the request with its members - same goes for the other.
WebClient is just a wrapper of the HttpWebRequest class, and simplifies many tasks that involve communicating with the web e.g up/downloading strings, data, files, and whatnot. Of course you lose some degree of control available in the WebRequest class and its derivatives. I just noticed you asked another question, whoops. For dealing with a standard API I'd say he WebClient would do just fine if no post data or encoding is required, else HttpWebRequest (which supports post/get). That also answers question 2 for logging in. (Apr 3, 2015 02:36 PM)Brako Wrote: If you want to use API and remote log in stuff use HTTPWebRequest have a look in JSON and REST Frameworks. Ah this is very much what I am looking into. The twitch API supplies JSON, so I have some research to do. Thank you. |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| [C#] by Johnny CashMay 17, 2020 11:21 PM | 1 | 111 |
May 17, 2020 11:21 PM Last Post: Shadow_Cloud |
| [C#] by draxyeeMay 13, 2020 08:33 AM | 5 | 214 |
May 13, 2020 08:33 AM Last Post: draxyee |
| [C#] by draxyeeSep 12, 2019 05:15 AM | 10 | 665 |
Sep 12, 2019 05:15 AM Last Post: riu41776 |