cookies and desktop application

不打扰是莪最后的温柔 提交于 2019-12-07 18:14:27

Yes, thats very much possible. When you receive the http reply from the server (probably using winhttp or curl) look for the http header 'Set-Cookie' It will be something like

 Set-Cookie: name2=value2; Expires=Wed, 09 Jun 2021 10:18:14 GMT

The cookie name is name2 and its value is value2 and it expires on 2021. Store this somewhere in your application context. All the expiry verification has to be done by your application. When you want to make a request with the cookie, set the additional request header 'Cookie'

 Cookie: name2=value2

If you are using winhttp WinHttpAddRequestHeaders and WinHttpQueryHeaders calls will be useful to do this task.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!