Access the RAW XML data in Web API
<p>I am using Web API to receive XML data and convert it to an Object. Which is working fine.</p>

<pre><code>    public void Post([FromBody] trackermessages model)
    {
        try
        {
</code></pre>

<p>How do I get the RAW XML data? Is there a way to get the XML data as the Request begins or inside this action?</p>

<p>I tried this:</p>

<pre><code>    public void Post([FromBody] trackermessages model, [FromBody] string rawText)
    {
        try
        {
</code></pre>

<p>But this is not allowed.</p>

<p>I also tried this:</p>

<pre><code>    public void Post([FromBody] trackermessages model)
    {
        try
        {
            var strean = new StreamReader(HttpContext.Current.Request.InputStream).ReadToEnd();
</code></pre>

<p>But I get the Exception:</p>

<blockquote>
  <p>This method or property is not supported after
  HttpRequest.GetBufferlessInputStream has been invoked.</p>
</blockquote>

<p>EDIT: </p>

<p>I am getting the Exception:</p>

<pre><code>var stream = await Request.Content.ReadAsStreamAsync();
stream.Seek(0, System.IO.SeekOrigin.Begin); // On this Line
StreamReader reader = new StreamReader(stream);
string text = reader.ReadToEnd();
</code></pre>

<p><a href="https://i.stack.imgur.com/N04VS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N04VS.png" alt="enter image description here"></a></p>