I'm trying to get HTML from a webpage. I've already get and set the cookies. Here is a piece of the request header:
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: <.......URL......>
Cookie: ASP.NET_SessionId=rk2tt31jgxyvszna1slzthho; .ASPXAUT=<.....token......>
Connection: keep-alive
Here's the header of a dump from a good response given by Live HTTP Headers:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sun, 24 Aug 2014 12:48:36 GMT
Content-Length: 13400
I'm using StreamReader(response.GetResponseStream(),Encoding.UTF8)
to read from the stream.
The problem is that StreamReader.ReadToEnd()
returns a lot of symbols instead of the HTML code:
�\b\0\0\0\0\0\0�\a`I�%&/m�{J�J��t