using (var contentStream = await this.Request.Content.ReadAsStreamAsync()) { contentStream.Seek(0, SeekOrigin.Begin); using (var sr = new StreamReader(contentStream)) { string rawData = sr.ReadToEnd(); } }
Tuesday, 15 August 2017
Capturing raw data in Web Api controller
I needed to capture raw POSTed data in a Web API controller endpoint. This is how it's done:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Comments are moderated, so you'll have to wait a little bit before they appear!