Reputation: 616
I want to implement a web listener to grab the posted array data from the webhook url. I have came across two ways to do this. 1. using IHttpHandler to handle the http request. 2. using wcf rest webservice to grab the request.
I also found that this can be done using a HttpListener but was unable to find a proper sample implementation.
Can anyone suggest the best way to do the above task and provide some references where I use to start the implementation.
Thank you.
Upvotes: 4
Views: 10391
Reputation: 171178
A webhook URL is not different than any other incoming HTTP request that you receive. You can use whatever mechanism you want for that.
If you are already using ASP.NET MVC then this is the best choice. If not you have the choice between adding MVC to the project or adding an HTTP handler.
HTTP handlers are a bit rough and inconvenient to use. I'd opt for MVC if there is no specific reason for not doing that.
HttpListener
does not apply at all here. You don't need to open a port (and in the context of ASP.NET you can't do that reliably anyway because multiple instances of your app might run at the same time during recycles).
Upvotes: 3