HTTPWebRequest Cookie different behaviour
I'm developing an application that needs to login into a website, www.example.com, using the class HTTPWebRequest and a CookieJar to handle Cookies.
The problem I have is that on some computers, the procedure works just fine, but on some others ( with a 1-1 ratio) it doesn't, with no SO/IE version pattern whatsoever.
I've tried logging every single GET and POST request, and here is the problem:
WORKING REQUEST
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0
Referer: http://account.example.com/login
Host: main.example.com
Cookie: ASP.NET_SessionId=gw5i1u55h5dz1uuydwhvu2er; ISBets_CurrentCulture=1; ISBetsForm=AAAA; SESSb3ef0b97a175642ae0744781875xxxxx=00000157671f81d4ea9f3589198768d4; authcache=59c1bd; drupal_user=foo; drupal_uid=543; isib_name=foo+bar
NOT WORKING REQUEST
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0
Referer: http://account.example.com/login
Host: main.example.com
Cookie: ASP.NET_SessionId=gw5i1u55h5dz1uuydwhvu2er; ISBets_CurrentCulture=1; ISBetsForm=AAAA;
The application is the same, and I use an HTTPWebRequest with an empty cookiejar every new restart of the program, and those are the request headers of the first POST request of the application: so, my question is, why are those 2 different? Shouldn't a cookiejar be empty the first time you use it? so, where the extra cookies come from?
After some other tests, I'm starting to doubt that the crossdomain "trick" is the whole problem, but again, is it possible that an option in IE makes this Set-Cookie an error:
Set-Cookie: SESSb3ef0b97a175642ae0744781875xxxxx=00000157671f81d4ea9f3589198768d4; expires=Mon, 18-Mar-2013 23:48:14 GMT; path=/; domain=.example.com; HttpOnly,authcache=59c1bd; expires=Mon, 18-Mar-2013 23:48:14 GMT; path=/; domain=.example.com, drupal_user=foo; expires=Mon, 18-Mar-2013 23:48:14 GMT; path=/; domain=.example.com, drupal_uid=543; expires=Mon, 18-Mar-2013 23:48:14 GMT; path=/; domain=.example.com, isib_name=foo+bar; expires=Mon, 18-Mar-2013 23:48:14 GMT; path=/; domain=.example.com
链接地址: http://www.djcxy.com/p/44894.html