0

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 ��!oAo��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 .

1
  • Try removing the accept encoding Commented Oct 31, 2015 at 13:24

1 Answer 1

1

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.