Decoding an input stream
<p>So I have a page that is accepting XML through a POST method. Here's a small bit of the code:</p>

<pre><code>if (Request.ContentType != "text/xml")
        throw new HttpException(500, "Unexpected Content Type");

StreamReader stream = new StreamReader(Request.InputStream);
string x = stream.ReadToEnd();  // added to view content of input stream

XDocument xmlInput = XDocument.Load(stream);
</code></pre>

<p>I was getting an error, so I converted the stream to a string, just to see if everything was being sent correctly. When I looked at the content, it looked like this:</p>

<blockquote>
  <p>%3c%3fxml+version%3d%271.0%27+encoding%3d%27UTF-8%27%3f%3e%0d%0a</p>
</blockquote>

<p>So I guess I need to decode the stream. The only problem is that I don't know how I can use HtmlDecode on the stream, and still keep it as a StreamReader object.</p>

<p>Is there any way to do this?</p>
