Ivan Climov

Ivan Climov

  • 967
  • 685
  • 21.3k

How to send data from WebHook to WinForm?

Jul 3 2019 5:55 AM
I need a WinForm application that will be a client for Viber.
I created a WebHook that accepts POST requests from a Viber server.
POST request contains JSON.
WebHook created from ASP.NET Framework template "Empty" + "MVC".
 
Question.
1. How to make, that if WebHook receives POST request, then received JSON went to "WinForm"?
2. If this solution is not acceptable, then how to organize the transfer of data from WebHook to WinForm in the framework of another solution?
 
Code HookController.cs 
  1. namespace WebAppl.Controllers  
  2. {  
  3.     public class HookController : Controller  
  4.     {  
  5.         // *** Original code ***  
  6.         // GET: Hook  
  7.         //public ActionResult Index()  
  8.         //{  
  9.         //    return View();  
  10.         //}  
  11.                   
  12.         [HttpPost]  
  13.         public string Index()  
  14.         {  
  15.             using (var reader = new StreamReader(Request.InputStream))  
  16.                 return reader.ReadToEnd();  
  17.         }  
  18.   
  19.     }  
  20. }  

Answers (12)