title: Can't read httpwebresponse
body: <p>I am getting a invalidoperation exception when I try to Deserialize a webresponse.</p>
  
  <p>In this webresponse I get an XML page which send over https.
  What my code does is basically send a webrequest to get login-cookies, then another request to get an XML page, afterwards i deserialize that page.</p>
  
  <p>The problem occurs when I try to deserialize, it gives me the following error:</p>
  
  <pre><code>There is an error in XML document (1, 1).
  </code></pre>
  
  <p>First I looked into my webresponse to see if it has proper data. So I put my webresponse into the streamreader and used readToEnd to convert it into string. Like so:</p>
  
  <pre><code>dim myStringResult as String = myStreamReader.ReadToEnd()
  </code></pre>
  
  <p>It gave me some letters numbers and blocks. So I think the response I get is the problem. I checked it out with Fiddler and saw that the response needed to be decoded before I could see the content(and yes it did have the proper response I wanted). I went a little deeper into the exception and saw it says</p>
  
  <pre><code>hexadecimal value 0x1F, is an invalid character. Line 1, position 1
  </code></pre>
  
  <p>I tried looking into the System.Text.Encoding, but couldn't find anything for hexadecimal.
  Can anyone help me with this? </p>
  
  <p>edit: It's possible that I have to decode it because it is a https response and not because it's hexadecimal encoded. </p>
  
  <p>edit1: I have tried <code>HttpUtility.HtmlDecode</code> unfortunately it didnt change the string. </p>
  
  <p>edit2:  example of data i am getting </p>
  
  <blockquote>
    <p>{� �U�r�0��+(g���(J��ԙ$�k;IomR&amp; �I�N?���/� 6���L�^`���</p>
  </blockquote>
  
  <p>it doesn't show the data right. It suppose to be mostly squars. Every now and then you see </p>
  
  <p>edit: the header</p>
  
  <blockquote>
  <pre><code>content-disposition: : attachment; filename="document.xml"
  CachingModuleShouldWork: true
  Content-Language: en-US
  
  Vary: Accept-Encoding,User-Agent
  </code></pre>
    
    <p>Content-Length: 382 Content-Type: application/xml</p>
  </blockquote>