I have a C# form application which I want to have listening for incoming HTTP requests from other computers.
How would I go about doing this?
To view the request or response HTTP headers in Google Chrome, take the following steps : In Chrome, visit a URL, right click , select Inspect to open the developer tools. Select Network tab. Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.
You can right click on the main Postman window > Inspect element. In the Network tab, you'll be able to see the request when you click the Send button. Clicking on the request in the Network tab will show you the response payload.
The most commonly used HTTP request methods are GET, POST, PUT, PATCH, and DELETE.
For simple needs, the HttpListener
class is a good and simple choice. There is an example on the linked MSDN page.
If, for some reason, you cannot use HttpListener
, the process would be to listen to a port using TcpClient
(or even the sockets API if you need the gritty details), and then implement the HTTP Protocol. I highly recommend HttpListener
over rolling your own, unless you have specific requirements that HttpListener
does not meet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With