'ASP.NET Core MVC and Webhooks
Disclaimer: I've never used a webhooks before, so this may be a dumb question...
I am making an app that gets data from several other applications via their api's and would like to send some data to my app with a webhook. I couldn't find any webhook receiver packages for these apps in NuGet, so I had a thought about just making a method on one of my controllers to post to. So, I made this:
[HttpPost]
public async Task<string> Test(int id)
{
if (id == 3)
{
using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
{
string rawValue = await reader.ReadToEndAsync();
Console.WriteLine(rawValue);
}
return "good job!";
}
return "You didnt send me a 3, go away!";
}
I am wondering, is this okay to do? or is there something else I should be doing instead? I tested this with the apps I wanted to send data with and it works just fine, but I didn't know if there would be some security concerns or anything else I should worry about this way.
This was just to test if it would work, if this is okay, I would be generating an id more secure than just the number 3.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
