Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:18:19+00:00 2026-06-15T10:18:19+00:00

please see the codes below : getData = ; txtLog.Text += req 5; txtLog.Text

  • 0

please see the codes below :

    getData = "";
    txtLog.Text += "req 5";
    txtLog.Text += "\r\n----------------------------------------------------------\r\n";
    txtLog.Text += "getData = " + getData;
    txtLog.Text += "\r\n----------------------------------------------------------\r\n";

    HttpWebRequest req5 = (HttpWebRequest)WebRequest.Create(link);
    req5.Method = "GET";
    req5.Accept = "image/png,image/*;q=0.8,*/*;q=0.5";
    req5.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20100101 Firefox/15.0";
    req5.ContentType = "text/html; charset=utf-8";
    //req5.Headers.Add("Accept-Encoding", "gzip, deflate");
    req5.Referer = location_from_req_2;
    req5.KeepAlive = true;
    //req5.AllowAutoRedirect = false;
    req5.Timeout = TimeOut;

    req5.Proxy = proxy;

    cookieJar = new CookieContainer();
    req5.CookieContainer = cookieJar;

    res = (HttpWebResponse)req5.GetResponse();
    txtLog.Text += ((HttpWebResponse)res).StatusDescription;
    txtLog.Text += "\r\n----------------------------------------------------------\r\n";

    //string[] cookies = res.Headers.GetValues("Set-Cookie");
    //string[] cookies_ = cookies;

    if (res.Cookies != null && res.Cookies.Count > 0)
    {
        cookieJar.Add(res.Cookies);
    }
    foreach (Cookie cookie in res.Cookies)
    {
        cookieJar.Add(new Cookie(cookie.Name.Trim(), cookie.Value.Trim(), "/", cookie.Domain));
    }
    if (!string.IsNullOrEmpty(res.Headers["Set-Cookie"]))
    {
        ArrayList al = ConvertCookieHeaderToArrayList(res.Headers["Set-Cookie"]);
        CookieCollection cc = ConvertCookieArraysToCookieCollection(al, "empty.com");
        cookieJar.Add(cc);
    }
    for (int i = 0; i < cookieJar.GetCookies(req5.RequestUri).Count; i++)
    {
        Cookie cookie = cookieJar.GetCookies(req5.RequestUri)[i];
        txtLog.Text += "#" + (i + 1).ToString() + "; name: " + cookie.Name.ToString() + "; value: " + cookie.Value.ToString() + "; path: " + cookie.Path.ToString() + "; domain: " + cookie.Domain.ToString() + "; version: " + cookie.Version.ToString();
        txtLog.Text += "\r\n++++++++++++++++++\r\n";
    }
    txtLog.Text += "cookieJar Count: " + cookieJar.Count.ToString() + "; req 5: " + req5.RequestUri;
    txtLog.Text += "\r\n----------------------------------------------------------\r\n";

    //string location_from_req_5 = res.Headers["Location"];

    Stream = res.GetResponseStream();
    reader = new StreamReader(Stream);
    reader_str = reader.ReadToEnd();
    txtLog.Text += reader_str;
    txtLog.Text += "\r\n----------------------------------------------------------\r\n";

    var image = Image.FromStream(Stream);
    imgCaptcha.Image = image;

    reader.Close();
    Stream.Close();
    res.Close();

i am using visual studio 2010 (.net 4) and a windows form application.
i want to show the goal web site’s captcha image in my picturebox!
i now CookieContainer is an important part of my codes and i think it works.
the reader_str string afetr these codes is like this :

"����\0JFIF\0\0`\0`\0\0��\0C\0\a\a\a\a\a\a\b\t\v\t\b\b\n\b\a\a\n\r\n\n\v\f\f\f\f\a\t\r\f\v\f\f\f��\0C\f\b\a\b\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f\f��\0\b\00\0�\"\0��\0\0\0\0\0\0\0\0\0\0\0\a\b\t\n\v��\0�\0\0\0}\0!1AQa\a\"q2���\b#B��R��$3br�\t\n%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���������������������������������������������������������������������������\0\0\0\0\0\0\0\0\a\b\t\n\v��\0�\0\a\0w\0!1AQ\aaq\"2�\bB����\t#3R�br�\n$4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������\0\f\0\0?\0����z��੿�\0��6�|i�5MZٮ��#es<�Ȥ��c��r\b�������9��~)y����6�N#����Ig?�#�\a��a2,~&ҍ&��e��#9U�vl�I��$�࿟���������ij���ƥ��`����c�\0��5O�<���s�����,�����\t<M*0p�X6m�R\b���W�G��j�T����᧯�C��[��ފ���������g�w��fWN������%�y�\n\f��{u=�����\0��\v������!ռ!�spmm��t��&���!q1f�l'�y��\fu9(�s7} �ޝ�[�j�^��TW�|\0���~�:����#Ŗ:���6�CM�)l����K�N�*�ܣq\\d��קוV��˒�Z}��i��\n(��QE\0Q\\w��\0�>��>k�9�o�x���ss<���rF]�\0w&�)u�;����c\a�>|��\0�u��6VwQE]���d���%p\a\\W��dx�t\\�ܒ����\b�H�I3�.�����\n��k_C$��\"���Y|i1F��J����^���F�i����~=��<�\n�G��-}�]k�i�w�zF��4p6�wʫ�\f`涫�غpu$�e��A�\nM��E�~����������U�?���i��<\t���qx����E��+x�9S��/�\\��q_n�c>?�oW�\0�zk�?�O�k⟇֖��Z�����������%ěv�-�0'�]X��P�F�f�{k5v�'d�����Ŧ�C������\0ি���\0���\a����x���:�x���nƊ�Q$�o춬�\t%�Y�_`�g���A���> �������&���y��fז�̫\"�++ಲ�#�\"��VU��+5̮�㪺�u��ٗ�z���?���U:ť���:���-u�y���+�G�uV�q_[��K�8ʺ0ea�EpJ�ĬU�(����TwQZ�2�a��'Ӛ\0��˳�Ƌ�^���X���Sʎ�6}è�9ȭJm5�_����<E���*���GHV[9�\v4�h�p �c�[>�g�G�C����/���V��\0Q[tU��q�rv�qY_�_�ٴ~�_�Uϊz5���ӵ����3��ݠ���S'�_�-?��z�����o��--�H�;{�\rj2*��,�����d�_u��;�f�Ž*E���~O�9���;�?g?��������G���\0\b�2���K�tY\t>��f�;?��/�{�?�T_ؗ�>\"0��_�b����ݦX����QU��g\\(��9�g�\0�[~4���\0�>�\"�IVK�j�� ݖEI�����q�+���8w�������\0f��.�[���/�+mWŒ[٬��������(���v5�S�ts��{ih��i%����r�$�\r�[�7�?k��/��o�ˋ��Xx7J���ѭ,E�4�mnF�),\0\f������ۃ����/��_נ��5�v�=�^�S��<E��q�\t�NY�\b��x\a�����\0�+?j}+���=�]k߳7��x�G�`�����Pħh*�H\v�s�\a����)����\n'�\0\a^Z|4I���:�ᛝt�3��[�������9�`�v��llC �_-�.t�ˊTޭ�׋�2}���|:�D�������,������\0�Z���I�Z����B�;�\tqt�~�*�\0H���O�G��e�\v����7�k=N)~x�Ņ���F��O2�:��3G&\b9�>1�|K�Z~�_�������D�\0~(��\0��O�N��\v[\0Ύ9 Tj�T�Tt!���T��e�7���\0���\0j����������P��m�Oi��̼�.4�w����$�!b\n��ҹ�IQB�t�QT��ȴ��ck4�k]^������mm��o��\0<7�W��%�f��xB��i��ofE��<��\0�2N8�߳���O�Wo�O�_�^�g��d��.�I\r��)��2��#���W�^�\0�n|g�\0��x���w�q{��+�dR\v�\r�&�.�^���w�#vA;Ԝ�*���#g�!�*���.��+�Yxx|��m<\v{{�\0�yd\t�7$�9&�\\N���Rnu:�ۖ>W��4��-R��o?��_�-v��\0$���~\\_��~�1�\fQ���*ײ�IPA�\ankS�\b�����:��O������O��6z�%�M&6�gftČ2�m8\a 濡�\n�����Ý>�Y|%�Wm� 73xz��\\t���\\�rs^���l����cL�!0¡~�����a�Y�^%M���7��'�_�c��?<����?�t����66�#����\t���%��<0--ѻ��0�@�#'ھ����/����?\r�v:焥�����-_tR]���\a�2+���}�\0����?�\0dK��^����'jڍ����R;���Pҗ�|�̣`O�O����m��⿃��Hm3�,.�ƷZ���tYd�Ӯ�UU��w�gǤ���32ɰ���(J���yd�u�h��*I���>\v�\0�O<-'�3�\0\t���0kQG�G{a43���<�����Cg ��`+��\0��/��\0?e?���/�� x�iQ��2ŧ�A&��r�\0�L0��z�d�'��/� o��V�i����_ǞL��X�c���\v��\"�y�VV\fv`�\a95�M��o���U߆��M��\r<ۄ�uI���E��l�X'����3,���ӓ���Z�������;y38Sn�#��{��\0�i��X��>j~!Ҽu�_�/Xo��#����,��`�\r�+�A�PA�p�\0�RO�6�?�e\t�|�um/�?\v��4�,jw���->�=���Ƞ$�$��W�T��?KeO��/�[�p������v�O&�ڬ�i�-ʨKa'�tM�\r#3���c���e�x��[\bҳ�����Y/GceE8�G��\r�0~�З��׾(�b���a�Y�5͌���[ʫ̌q�0$\r��_��<x���g��;���ĝw�vZ��n�r��ߝ�D����7�_\0z���?�����\0�s����#Q��m�Y�~�\r�m\r���Y��2��\b�U\nŔ4��k���\b��#|Uмy�~Ӛ7��ߍ^��mF��\v뫿/+4�w�X� ��dg��fq����Ww[(I��ݔ��z%Ͷ��qV�������#����A|�\0�{�?�yw�o�݊^h��A��1����w�`\\�1\a�����(O�o�\0N���gy.��熴x����\b��]鷧�$�Ӆ�����������I���\0��K�\v�F��͠jV���h�9���X�pT`���?�,�ů��/���?b���#��Q���a��CÐ>���U�b>�Z����6�R�IyE�o���U �R�h�1�?�������Oҿh���+����������\a���\v�;z�=+��0�\0�p��M���?l��k��u_L���lW�\05����?\r�C������>��ʞ\rg��a�_�e#����������ǃM���=j���Z��2K\a�����8r;a�v���b�5�}�tW�:p���S�+y'�s�aO�&��\0\v����_���^�i�~8y���1��<RIv�xۑ�#\"�I����e�\0����U�I<'�\a�v��o٧�t�W�{��\\\b�h��\0I�9��M�Ԃ\0�s���k㸯���n����;9C�ٵ�%t�QE��_�\0�������kǩcm%ֱ�-�OeQ%��|J�\a<�$��\0�_{Q]�~2XLM<L7�O�{|ɔy�L�R�\0�6�x3�_�Ox�@�4�(�+wO����F�'�eV`lE\t�\\��KZD�I�2I�%FMIEt�Y���6x�^^ki{�K˰�Ò*#Zd\nQJ��q_�_�����'���\0d����g��x�/iˢ���R�XMq���Ͷv\v�M~��X���L$�($ԓ�Of�����c��>4���<o�z���~$|k�ŧ�<#���\fx%� ���VeU��ۼ�2E�1$oԒ�\b��O� .��1~Ԟ4���+�Q�J�%��5\rs¶�#5�����s\\yn��8��i���г�\\iʍ)r�J�]�ݓwz���R}�ove�������z��oq�O��Mi�m�:�xܤ�{�_�zG���?\v��G���\0h�.�{��m�,J��'XOZ�8���f��\"q�+'�����\b�s�X�\0�u�]�*k_����5+)�\t��H�ܫ1k�_�k�DZ�!���ĩIɞ�[��v�\")����cEw�ٟ/,j���'�ñ����\0\a���\0e��\r�4���-�����̚���NVH��X��8e ��%T\"�\0\0p\0�KEyx�n#.|D��v��ˌTtH(���((��\0��\vi�6��擬X��zf�\v[�Z��$�x�a���A�+�\a�?\b~����>\a�։�?[I$��U�Z���Ŝ�h��I⺊*�Ir�_N��*�P\0\0@�\f▊�#��.<�(p�H��RQE�EP�\0\0=-P\a��\r\n\r\n"

i think this is our image and now i want to show it in my picturebox.
but i always have error in this line -> var image = Image.FromStream(Stream);
and that error -> Parameter is not valid.
what is going on and what is the problem!?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:18:20+00:00Added an answer on June 15, 2026 at 10:18 am

    I think the problem is that you’re reading out the data from the stream and forgetting to reset it to the beginning. Just don’t read out the data into a string, and you should be fine.

    Stream = res.GetResponseStream();
    //reader = new StreamReader(Stream); <-- Don't do these 4 lines
    //reader_str = reader.ReadToEnd();
    //txtLog.Text += reader_str;
    //txtLog.Text += "\r\n----------------------------------------------------------\r\n";
    
    var image = Image.FromStream(Stream);
    

    If you want to keep the lines, you just have to reset the stream back to the beginning, using:

    Stream.Seek(0, SeekOrigin.Begin);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see the below codes : private string GetUserIPAddress() { string User_IPAddress = string.Empty;
Please see below codes and output. NSDateComponents *dateComponents = [[[NSDateComponents alloc] init] autorelease]; [dateComponents
Please see code below : public class NewsFilterModel { public CtArticleDetail ArticleDetail { get;
Please see my code below: var callback = function(popup_window) { popup_window.close(); //some more codes
Please see BST codes below. It only outputs 5. what did I do wrong?
I have a function(please see code below) which reads some data from the web.
Please see the code below: #include <iostream> #include <stdlib.h> #include <time.h> using namespace std;
I've a problem with CakePHP __() function. Please see the code below : $options
I am using vb.net code. I have grid view, please see the code below:
Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.