C ++ builder TIdHttp cannot obtain cookie, buildertidhttp

Source: Internet
Author: User

C ++ builder TIdHttp cannot obtain cookie, buildertidhttp

Use the TIdHttp component of c ++ builder to Get a page of the ASP. Net MVC server, obtain the Cookie information in the page, and Post the modification to the server.

After local debugging, you can obtain the Cookie. If you deploy it on the server, you cannot obtain the Cookie. You can use FireBug in FireFox to open the webpage and view the Cookie information. Then, you can use Wireshark to view the Get data, the Cookie has the HttpOnly attribute, and CookieManager of TIdHttp cannot obtain it. Search for the Cookie information found in m_IdHttp-> Response-> RawHeaders. Then, extract the Cookie and set the Cookie information in CustomHeaders of Requst.

The related code is as follows:

1 // obtain Cookie2 AnsiString cookies = m_IdHttp-> Response-> RawHeaders-> Values ["Set-Cookie"]; 3 // set Cookie4 m_IdHttp-> Request-> CustomHeaders-> AddValue ("Cookie", cookies );

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.