Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. [HttpPost]
  2.  
  3. public async Task<ActionResult<int>> Process()
  4. {
  5. string jsonString = await GetRequestBody();
  6. ...
  7. }
  8.  
  9. private async Task<string> GetRequestBody()
  10. {
  11. string jsonString;
  12. using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
  13. {
  14. jsonString = await reader.ReadToEndAsync();
  15. }
  16.  
  17. return jsonString;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement