Click here to Skip to main content
15,902,189 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I Want to create a session cookie in c++ with out using any third party CGI.
Posted
Comments
[no name] 12-Sep-12 14:09pm    
You are more than welcome to create your own sample code.
Sergey Alexandrovich Kryukov 12-Sep-12 18:01pm    
OK, any questions?
--SA

1 solution

Okay, so you know how to create http request/response headers, right?
Just add a field for the cookies and set them.

Example Request header:
GET /script/Answers/List.aspx?tab=active HTTP/1.1
Host: www.codeproject.com
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://www.codeproject.com/script/Membership/MyNotifications.aspx
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: srvid=1328, 1335; ui-tabs-1=0; cntid=16;



Example Response header:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Set-Cookie: SessionGUID=<identifying value="" removed="">; path=/
Set-Cookie: mguid=<identifying value="" removed="">; domain=.codeproject.com; expires=Sat, 12-Sep-2037 04:00:00 GMT; path=/
Set-Cookie: SessionGUID=<identifying value="" removed="">; path=/
Set-Cookie: mguid=<identifying value="" removed="">; domain=.codeproject.com; expires=Sat, 12-Sep-2037 04:00:00 GMT; path=/
Date: Wed, 12 Sep 2012 18:51:25 GMT
Content-Length: 13947
</identifying></identifying></identifying></identifying>
 
Share this answer
 

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