I am getting a invalidoperation exception when I try to Deserialize a webresponse.
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.
The problem occurs when I try to deserialize, it gives me the following error:
There is an error in XML document (1, 1).
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:
dim myStringResult as String = myStreamReader.ReadToEnd()
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
hexadecimal value 0x1F, is an invalid character. Line 1, position 1
I tried looking into the System.Text.Encoding, but couldn't find anything for hexadecimal. Can anyone help me with this?
edit: It's possible that I have to decode it because it is a https response and not because it's hexadecimal encoded.
edit1: I have tried HttpUtility.HtmlDecode
unfortunately it didnt change the string.
edit2: example of data i am getting
{� �U�r�0��+(g���(J��ԙ$�k;IomR& �I�N?���/� 6���L�^`���
it doesn't show the data right. It suppose to be mostly squars. Every now and then you see
edit: the header
content-disposition: : attachment; filename="document.xml" CachingModuleShouldWork: true Content-Language: en-US Vary: Accept-Encoding,User-Agent
Content-Length: 382 Content-Type: application/xml