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. SMTP命令

    SMTP(Simple Mail Transfer Protocol)简单邮件传输协议 Basic Commands: HELO(Hello):标识用户身份 MAIL FROM:发件人地址 RCPT ...

  2. PHP 根据二维数组中的某个字段进行排序

    <?php $data = array( array( 'id' => 5698, 'first_name' => 'Bill', 'last_name' => 'Gates' ...

  3. Oracle 多租户环境学习路线图

    Category Topic Documentation Concepts Overview of CDBs and PDBs "Overview of the Multitenant Ar ...

  4. springboot系列(四)springboot 配置

    在springboot出现之前,spring项目会存在多个配置文件,如web.xml,配置spring的多个spring-xxx.xml,xxx代表配置spring的某一功能,如aplication- ...

  5. idou老师教你学istio 21:基于角色的访问控制

    istio的授权功能,也称为基于角色的访问控制(RBAC),它为istio服务网格中的服务提供命名空间级别.服务级别和方法级别的访问控制.基于角色的访问控制具有简单易用.灵活和高性能等特性.本文介绍如 ...

  6. [ 转载 ] Java基础二

    前言 关于赢在面试的Java题系列基本收集整理完成了,所有题目都是经过精心挑选的,很基础又考验求职者的基本功,应该说被面试到的几率很大.这里整理挑选出来供大家面试前拿来看一看,所有题目整理自网络,有一 ...

  7. windows builder里面的可伸缩面板

    使用 org.eclipse.wb.core.controls.flyout.FlyoutControlComposite.FlyoutControlComposite类 构造方法中传入的prefer ...

  8. GEF中TreeViewer的叶子节点展开

    /** * GEF树叶子节点的展开 * @param items */ private void expand(TreeItem[] items) { for (int i = 0; i < i ...

  9. Pandas to_sql TypeError: sequence item 0: expected str instance, dict found

    问题介绍 打印了一下数据格式,并未发现问题.如果说是字典实例引起的. 我猜测也是extra字段引起的,因为extra字段是一个json字段.根据网上的提示要对这样的格式进行强转str. 其他发现:pd ...

  10. 解压 .tar.xz 格式的压缩文件

    第一种方法: xz -d mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz tar -xvf mysql-8.0.16-linux-glibc2.12-x86_64 ...