There are several ways to perform HTTP GET, POST.. requests in C#. The following example is using the legacy HttpRequest Class provided by .NetFramework without adding one more additional dependency (Nuget Packages) for something that works really well in .NET implementation and is usually unnecessary for small hobby projects but also not a good practice in professional projects.

WebRequest and more specifically the HttpWebRequest class is a good starting point for our purpose. To create the request you will use the WebRequest.Create and cast the created request to an HttpWebRequest to actually use it.

Please feel free to use the following code snippet as a reference to your actual implementation.

Author

Write A Comment