Reputation: 103
I Have this code
internal static SourceCookieSTatue LoadSource(string p)
{
SourceCookieSTatue __Result__ = new SourceCookieSTatue();
try
{
var Request = (HttpWebRequest)WebRequest.Create(p.Trim());
Request.UserAgent = MrHTTP.Chrome_UserAgent;
Request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
Request.Headers.Add("Accept-Language", "en-US,en;q=0.5");
Request.Headers.Add("Accept-Encoding", "gzip, deflate");
var response = (HttpWebResponse)Request.GetResponse();
string x = new StreamReader(response.GetResponseStream()).ReadToEnd();
string CokString = MrHTTP.GetCookieString(response.Headers);
return new SourceCookieSTatue(x, CokString);
}
catch (Exception sa) { return new SourceCookieSTatue(sa.Message,false);
}
when i send the http request it return chars like these
���;Yo#Gz���פ�d7��(QcIsz5�K�d1���d���z��"5Z�X�a ��!oA
o��Yl ��WH��� ����>8#ً
���������{����4㞋??8zp���a�M��0n�F{�����tb?��2��q� i3�a,}��Y85��K�+&'�m���mnk{k�r����ѸLw{{;�
when i intercept the request using BURP-SUite it works correctly .
Upvotes: 0
Views: 44
Reputation: 726
The problem is in the following line:
Request.Headers.Add("Accept-Encoding", "gzip, deflate");
You are adding a compression parameter in your request header. You can either remove the compression parameter or you can define the default behavior to decompress your request by adding the following line:
Request.AutomaticDecompression = DecompressionMethods.GZip;
Upvotes: 1