Cookiecontainer involved in httpwebrequest in C #2.0 is somewhat problematic.

Source: Internet
Author: User

 

I found this problem early. Now I find that many times it affects my program. Description:

1: If cookie1 is obtained by requesting www.xxx.com/a/a.php

2: If cookie2 is obtained by requesting www.xxx.com/ B/B .php

 

When I request www.xxx.com/c/c.php, both cookie1and cookie2cannot be automatically added. Why. Because the path values of cookie1 and cookie2 are different, the solution is as follows: when the cookie is obtained, set the path value first, then add it to cookiecontainer ..

 

In fact, it is not completely a cookiecontainer problem. When this problem occurs, it is also related to the server. For example, if there is no path in the Set-cookie in the server's response, cookiecontainer directly uses the current request path as the path .. If the set-cookie in the server's response has a path, cookiecontainer will still be set normally.

I always think it is not perfect ..

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.