How to get raw request body in ASP.NET?

前端 未结 6 1134
你的背包
你的背包 2021-01-07 16:12

In the HttpApplication.BeginRequest event, how can I read the entire raw request body? When I try to read it the InputStream is of 0 length, leadin

6条回答
  •  攒了一身酷
    2021-01-07 17:01

    In ASP.NET Core 2:

    using (var reader = new StreamReader(HttpContext.Request.Body)) {
        var body = reader.ReadToEnd();
    }
    

提交回复
热议问题