How to get raw request body in ASP.NET?

前端 未结 6 1135
你的背包
你的背包 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 16:43

    I had a similar requirement to get the raw content and struck the same issue. I found that calling Seek(0, SeekOrigin.Begin) solved the problem.

    This is not a particularly good approach as it makes assumptions about how the underlying infrastructure operates, but it seems to work.

提交回复
热议问题