简体   繁体   中英

Getting POST or PUT request body prior to serialization (.NET, C#)

We (our dev team) have a need to inspect an inbound POST or PUT request body prior to serialization.

We don't need to transform or manipulate anything, simply be able to see and possibly record the body for future analysis.

We need to look at the raw request body not the request as it was serialized.

This is a straightforward Web API app running on IIS7. Our controllers are based on the system.Web.Http ApiController class.

I investigated finding this in the Request object, but despite it containing a plethora of information about the headers and the like, it did not seem to contain the raw request body, which is what i am looking for. I did find some prior posts that described getting this through the Request.InputStream, but this does not appear to be available in .Net 4.5.

Thanks for any insights.

-r

PS .Net 4.5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM