Cookies

1.创建
HttpCookies Cookie=new HttpCookies("CookieName");
2.添加内容
Cookie.Values.Add("UserName","ABC");

Cookie["UserName"]="ABC";
3.修改内容
Cookie.Values["UserName"]="CBA";
4.读取内容
var UserName=Cookie.Values["UserName"];
5.设置失效时间(删除cookie就是讲失效时间设置的比现在时间早,在下一次打开网页的时候就会自动删除Cookie)
(删除Cookie的时间是下一次打开新的网页,也就是如果没有打开新的网页,Cookie不会被删除,依旧)
(可以读取其中的数据)
Cookie.Expires=DateTime.Now;
6.将修改的信息传入客户端(所有更改类操作都必须这样做,否则不会将更改保存到客户端Cookie)
Response.AppendCookies(Cookie):将 Http cookie追加加到Cookies集合,同key的cookie可以重复添加,总是添加而不是更新,它和HttpResponse.Cookies.Add的功能几乎一样,最大的区别是添加前后的事件和抛出的异常不尽相同。
HttpResponse.Cookies.Add:将指定cookie添加到Cookies集合,同key的cookie可以重复添加,总是添加而不是更新.
HttpResponse.SetCookie:更新Cookies集合中第一个同key的cookie,如果找不到同key的cookie,则添加一个cookie到Cookies集合中。
7.获取客户端Cookies
Request.Cookies["CookieName"];
8.无法从客户端Cookies中获取Expires的值,所以若要判断该时间,需要一个新的Values[]来存储

转载于:https://www.cnblogs.com/GZNETLGN/p/8931059.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Universal Data Access Components Source Code Copyright 1997-2009, Devart. All Rights Reserved There are two ways to compile and install UniDAC for Windows manually. I. Using IDE Delphi and C++ Builder for Win32 -------------------------------- Run your IDE and walk through folowing steps: 1) Compile DAC run-time package (dacXX.dpk) 2) For Delphi 6,7 or C++ Builder 6 compile DAC GUI related package dacvclXX.dpk 3) Compile DAC design-time package (dcldacXX.dpk) 4) Compile UniDAC run-time package (unidacXX.dpk) 5) For Delphi 6,7 or C++ Builder 6 compile UniDAC GUI related package unidacvclXX.dpk If you are going to create CLX applications compile UniDacClx.pas unit separately. 6) Compile and install UniDAC design-time package (dclunidacXX.dpk) You can find these packages in Source\Delphi5\*.dpk - for Delphi 5 Source\Delphi6\*.dpk - for Delphi 6 Source\Delphi7\*.dpk - for Delphi 7 Source\Delphi9\*.dpk - for Delphi 2005 Source\Delphi10\*.dpk - for Delphi 2006 Source\Delphi11\*.dpk - for Delphi 2007 Source\CBuilder5\*.bpk - for C++ Builder 5 Source\CBuilder6\*.bpk - for C++ Builder 6 To compile UniDAC based application add UniDAC Source directory path to the "Library Path". Delphi for .NET ----------------- Run your IDE and walk through folowing steps: 1) Compile DAC run-time package (Devart.Dac.dpk) 2) Compile DAC design-time package (Devart.Dac.Design.dpk) 3) Compile UniDAC run-time package (Devart.UniDac.dpk) 4) Compile and install UniDAC design-time package (Devart.UniDac.Design.dpk) 5) Specify the path to compiled assembles in "Assembly Search Paths" You can find these packages in Source\Delphi9\*.dpk - for Delphi 2005 Source\Delphi10\*.dpk - for Delphi 2006 To compile UniDAC based application add Devart.Dac and Devart.UniDac to Namespace prefixes, add UniDAC Source directory path to the "Library Path" list. II. Using make-files Delphi and C++ Builder for Win32 -------------------------------- 1) Go to one of the following folders (let's denote this folder %MakePath%): Source\Delphi5 - for Delphi 5 Source\Delphi6 - for Delphi 6 Source\Delphi7 - for Delphi 7 Source\Delphi9 - for Delphi 2005 Source\Delphi10 - for Delphi 2006 Source\Delphi11 - for Delphi 2007 Source\CBuilder5 - for C++ Builder 5 Source\CBuilder6 - for C++ Builder 6 2) Find in the 'Make.bat' line containing set IdeDir="D:\Program Files\Borland\Delphi7 and make sure that correct path to IDE is set (always include forward quote and do not include ending quote) 3) Run 'Make.bat'. Binaries will be copied to %MakePath%\UniDac subfolder 4) Copy %MakePath%\UniDac\*.bpl files to a folder that is included in the PATH environment variable 5) Run IDE and add dclunidacXX.bpl via Component->Install Packages... menu 6) To compile UniDAC based application add UniDAC Source directory path to the "Library Path" list Delphi for .NET ----------------- 1) Go to the following folders (let's denote this folder %MakePath%): Source\Delphi9 - for Delphi 2005 Source\Delphi10 - for Delphi 2006 2) Find in the 'Make.bat' line containing For Delphi 2005: set IdeDir="D:\Program Files\Borland\BDS\3.0 For Delphi 2006: set IdeDir="D:\Program Files\Borland\BDS\4.0 and make sure that correct path to IDE is set (always include forward quote and do not include ending quote) 3) Run 'Make.bat'. Binaries will be copied to %MakePath%\UniDac subfolder 4) Run IDE and add Devart.UniDac.Design.dll via Component->Installed .NET Components->.NET VCL Components->Add... menu. Specify the path to compiled assembles in Component->Assembly Search Paths->Add... menu 6) To compile UniDAC based application add Devart.Dac and Devart.UniDac to Tools->Options->Environment Options->Delphi Options->Library-> Namespace prefixes
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值