using System.Net; WebClient client = new WebClient(); client.DownloadFile("https://example.com/file.txt", "file.txt");
using System.Net; WebClient client = new WebClient(); string postData = "name=John&age=30"; byte[] response = client.UploadData("https://example.com/submit", Encoding.UTF8.GetBytes(postData));This code creates a new instance of WebClient and uses the UploadData method to send the POST request to the server with the specified data and encoding. The response from the server is then stored in a byte array. The WebClient class is part of the .NET Framework, so no external package or library is required.