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;

  

最新文章

  1. 开放式管理基础结构 OMI
  2. PAT/进制转换习题集
  3. linux启动jmeter,执行./jmeter.sh报错解决方法
  4. [整理]android中几种常见的尺寸
  5. spring mvc超强的json支持,你自己根本不需要额外的配置。spring mvc都给你配置好了!!!
  6. robot.libdocpkg package
  7. 使用Cross-validation (CV) 调整Extreme learning Machine (ELM) 最优参数的实现(matlab)
  8. MLlib-协同过滤
  9. oracle 非数字型转数字型
  10. OpenSUSE13.2安装MongoDB
  11. Microsoft Visual Studio 2015 python 安装 mysql-python 出错解决
  12. libcrypto.so.1.0.0内容丢失导致sshd无法运行解决方案
  13. sqlserver 数据库关于存储xml字段里内容的查找与替换
  14. 用 Django 管理现有数据库
  15. Django Redis存储session会话
  16. bash脚本里su命令执行
  17. SQL基础--查询之一--单表查询
  18. discuz安装,uc_server目录下乱码问题:
  19. cocoapod 最新安装使用步骤
  20. input 隐藏边框

热门文章

  1. MySQL: Can’t connect to MySQL server on (111 “Connection refused”)
  2. Hadoop集群搭建(cluster setup),ssh免密后一直要求输入密码的原因
  3. php使用播放插件播放m3u8,mp4,flv格式的视频
  4. Codeforces 850C E. Arpa and a game with Mojtaba
  5. Ubuntu18.0 解决python虚拟环境中不同用户下或者python多版本环境中指定虚拟环境的使用问题
  6. 用python文件操作实现复制图片、视频
  7. 用js刷剑指offer(用两个栈实现队列)
  8. webpack中css文件的代码分割
  9. Java数组复制、遍历、反转
  10. Selenium(九)测试用例数据分离与从文件导入数据