Click here to Skip to main content
15,904,024 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to send cookies using Qnetworkaccessmanager in visual studio2010.
I have to send lso cookie with the http request. The cookie is already stored in my system.
Help appreciated in advance!!
Posted
Comments
Code-o-mat 23-Nov-11 12:00pm    
Shouldn't you rather look around this:
http://doc.qt.nokia.com/latest/qnetworkaccessmanager.html , especially this:
http://doc.qt.nokia.com/latest/qnetworkaccessmanager.html#cookieJar
and maybe this:
http://doc.qt.nokia.com/latest/qnetworkcookiejar.html
?

1 solution

If you want to send Cookie then you will have to follow specific protocol related with cookie ,

Just read the HTTP protocol Properly and send cookie accordingly. By the way did you implement all the http client or used any other http class?
 
Share this answer
 
Comments
Avinash Pachar 1-Dec-11 1:30am    
i want to send token value of LSO cookie along with a get request.
please suggest anyway you know.
Mohibur Rashid 1-Dec-11 1:52am    
sprintf(temp,"GET "DATAREAD"?DateFrom=%s&DateTo=%s HTTP/1.0\r\n",dateFrom,dateTo);
strcpy(buffer,temp);
strcpy(temp,"");
sprintf(temp,"Host: %s\r\n",address);
strcat(buffer,temp);
strcat(buffer,temp);
strcpy(temp,"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n");
strcat(buffer,temp);
strcpy(temp,"Accept-Language: en-us,en;q=0.5\r\n");
strcat(buffer,temp);
strcpy(temp,"Accept-Encoding: gzip,deflate\r\n");
strcat(buffer,temp);
strcpy(temp,"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n");
strcat(buffer,temp);
strcpy(temp,"Keep-Alive: 115\r\n");
strcat(buffer,temp);
strcpy(temp,"Connection: keep-alive\r\n");
strcat(buffer,temp);
sprintf(temp,"Cookie: %s\r\n\r\n",cookie);

this is the code i use for sending GET request
Mohibur Rashid 1-Dec-11 1:55am    
Lots of issue is pointless, like charset, encoding, accept language, because I didnt wrote an universal application, I just have written a simple application to get some data from http server
Avinash Pachar 1-Dec-11 5:40am    
Exact scenario is like this.
there is a site which require authentication. I want that after the user has logged into the site through browser, i want that my code should take that cookie from hard disk and send a get request to portal with that cookie so that authentication is not required. If i am right how i can do that? thank you for your help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900