I have been trying this whole day with no success. Please help in solving the issue. On googling I found many users had this issue but nowhere I could find a solution.
I think cookies are linked to the URLs they are obtained from. So in your second POST with a different URL, the cookies from the first POST are not sent with the request.