Can we implement web-hook listener in web services(asmx)?

I want to implement web hook listener in my web services(asmx). I searched a lot about this but couldn't find any solution. Is it possible? Thanks!

3 answers

  • answered 2019-01-11 05:41 Jalal

    I haven't test it, But I think the general idea would be like this:


    <%@ WebService language = "C#" class = "NotifyService" %>
    using System;
    using System.Web.Services;
    using System.Xml.Serialization;
    [WebService(Namespace = "http://localhost/")]
    public class NotifyService: WebService{
       [ScriptMethod(UseHttpGet = true)]
       public String Notify(string name) 
          return "Hello " + name;

    Then you can call it by requesting GET http://localhost/NotifyService.asmx/Notify?name=Dude

  • answered 2019-01-11 06:28 Svek

    Based on your question, I am assuming that you only need a reference to resources to get you started? If so:

    Frankly, I am not sure you put enough effort before asking the question, as a few google searches gave these results quite quickly. There is a lot more resources to help you get started with ASP.NET WebHooks.

  • answered 2019-01-11 11:00 Dungeon

    I did this way:

    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public void WebHookDataRecieve() //This method is called from Amazon Simple Notification Service when we receive a bounce.
     string notification = "";
     using (var stream = new MemoryStream())
       var request = HttpContext.Current.Request;
       request.InputStream.Seek(0, SeekOrigin.Begin);
       notification = Encoding.UTF8.GetString(stream.ToArray());//All of your data will be here in JSON format.
       //Simply parse it and access the data.

    This worked.