delphi nethttpclient操作cookie

unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Net.URLClient,
System.Net.HttpClient, System.Net.HttpClientComponent; type
TForm1 = class(TForm)
NetHTTPClient1: TNetHTTPClient;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject);
var
cookie: TCookie;
begin
for cookie in NetHTTPClient1.CookieManager.Cookies do
begin if (cookie.Domain = 'www.server.com') and (cookie.Name = 'test') then
begin
//
end;
end;
end; end.

  TCookie:

  /// <summary>Cookie record.</summary>
TCookie = record
private
class function StrExpiresToDateTime(const AStrDate: string): TDateTime; static;
public
/// <summary>Cookie Name</summary>
Name: string;
/// <summary>Cookie Value</summary>
Value: string;
/// <summary>Cookie Expires. It's the date when the cookie will expire</summary>
/// <remarks>When Expires is 0 means a session cookie.</remarks>
Expires: TDateTime;
/// <summary>Cookie Domain</summary>
Domain: string;
/// <summary>Cookie Path</summary>
Path: string;
/// <summary>Cookie Secure</summary>
/// <remarks>If True then the cookie will be sent if https scheme is used</remarks>
Secure: Boolean;
/// <summary>Cookie HttpOnly</summary>
/// <remarks>If True then the cookie will not be used in javascript, it's browser dependant.</remarks>
HttpOnly: Boolean; /// <summary>Return the cookie as string to be send to the server</summary>
function ToString: string;
/// <summary>Return a TCookie parsing ACookieData based on the URI param</summary>
class function Create(const ACookieData: string; const AURI: TURI): TCookie; static;
end;

  

delphi nethttpclient操作cookie的更多相关文章

  1. JavaScript 操作 Cookie

    转自作者:聂微东出处:http://www.cnblogs.com/Darren_code/      什么是 Cookie “cookie 是存储于访问者的计算机中的变量.每当同一台计算机通过浏览器 ...

  2. js简单操作Cookie

    贴一段js简单操作Cookie的代码: //获取指定名称的cookie的值 function getCookie(objName) { var arrStr = document.cookie.spl ...

  3. Jquery操作cookie,实现简单的记住用户名的操作

     一.jquery.cookie.js介绍  jquery.cookie.js是一个基于jquery的插件,一个轻量级的cookie 插件,可以读取.写入.删除 cookie. jquery.cook ...

  4. jquery.cookie.js 操作cookie实现记住密码功能的实现代码

    jquery.cookie.js操作cookie实现记住密码功能,很简单很强大,喜欢的朋友可以参考下.   复制代码代码如下: //初始化页面时验证是否记住了密码 $(document).ready( ...

  5. Asp.net操作cookie大全

    实例代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 3 ...

  6. Delphi Excel 操作大全

    Delphi Excel 操作大全 (一) 使用动态创建的方法首先创建 Excel 对象,使用ComObj:var ExcelApp: Variant;ExcelApp := CreateOleObj ...

  7. ASP.NET 操作Cookie详解 增加,修改,删除

    ASP.NET 操作Cookie详解 增加,修改,删除 Cookie,有时也用其复数形式Cookies,指某些网站为了辨别用户身份而储存在用户本地终端上的数据(通常经过加密).定义于RFC2109.它 ...

  8. ASP.NET操作Cookie

    1.生成Cookie public static void SetDataByCookie(string mainKey, string subKey, string value, string do ...

  9. 关于Jquery 操作Cookie 取值错误

    使用JQuery操作cookie时 发生取的值不正确的问题: 结果发现cookie有四个不同的属性: 名称,内容,域,路径 $.cookie('the_cookie'); // 读取 cookie $ ...

随机推荐

  1. webpack如何使用vue

    1.安装vue的包:  cnpm i vue -S 2.在main.js中导入包 3.运行起来报错 3.1第一种解决办法: 3.2第二种解决办法: 让我们先回顾一下包的查找规则: //1.找项目根目录 ...

  2. svm 简单明了的入门级使用教程(转载)

    如何使用libsvm进行分类   这帖子就是初步教教刚接触libsvm(svm)的同学如何利用libsvm进行分类预测,关于参数寻优的问题在这里姑且不谈,另有帖子详述. 其实使用libsvm进行分类很 ...

  3. 4.闭锁 CountDownLatch

    /*CountDownLatch 闭锁*/ CountDownLatch 是一各同步辅助类,在完成一组正在其他线程中执行的操作之前,它允许一个或多个线程一直等待 闭锁可以延迟线程的进度 直到 其到达终 ...

  4. MFC编程——Where is WinMain?

    源码 #include<afxwin.h> class MyApp :public CWinApp { public: virtual BOOL InitInstance(); }; My ...

  5. Python3+Appium学习笔记09-元素定位android_uiautomator

    appium是使用了uiautomator的框架的,所以uiautomator所带的定位方式.appium也是支持的 需要使用appium中find_element_by_android_uiauto ...

  6. gorm忽略struct种的field, 不映射到表里面

    https://github.com/jinzhu/gorm/pull/1111/commits/3c01fe791514d7064791a17d8b067106866d1e2f

  7. Spring整合rabbitmq(转载)

    原文地址:https://my.oschina.net/never/blog/140368 1.首先是生产者配置 <?xml version="1.0" encoding=& ...

  8. 转发:i p _ f o r w a r d函数

    转发:i p _ f o r w a r d函数到达非最终目的地系统的分组需要被转发.只有当 i p f o r w a r d i n g非零或当分组中包含源路由时,i p i n t r才调用实现 ...

  9. Codeforces Educational Codeforces Round 54 题解

    题目链接:https://codeforc.es/contest/1076 A. Minimizing the String 题意:给出一个字符串,最多删掉一个字母,输出操作后字典序最小的字符串. 题 ...

  10. this绑定问题

    this是属性和方法“当前”(运行时)所在的对象.this是函数调用时发生的绑定,它的值只取决于调用位置(箭头函数除外). 函数调用的时候会产生一个执行上下文,this是对这个执行上下文的记录. ❌误 ...