I used a CookieContainer to held some cookie. Usually the new cookie should override the old one but it doesn't override this time, instead, the new one join the cookies family and have a very nice day with the elder one.
Afterwards we can even see a request with two cookies sharing one name with different values.
This is the first time I have such a problem and it's very wired. It took me many many many mant time to find out where the duplicate cookie come from. the code is simple and normal:
request.CookieContainer = cookieContainer;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
//the duplicate one came in after GetResponse().
}
before GetResponse() the cookieContainer.Count == 5 and after it became six.
Aucun commentaire:
Enregistrer un commentaire