using System;
using System.Web; /// <summary>
///session操作类
/// </summary>
public class appCookie
{ #region COOKIE 操作相关
/// <summary>
/// 写入Cookie
/// </summary>
/// <param name="strName"></param>
/// <param name="strValue"></param>
public static void WriteCookie(string strName, string strValue)
{
WriteCookie(strName, strValue, );
} public static void WriteCookie(string strName, string strValue, int expires)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
//cookie.Domain = domain;
cookie.Value = strValue;
cookie.Expires = DateTime.Now.AddDays((double)expires);
HttpContext.Current.Response.AppendCookie(cookie);
} public static string GetCookie(string strName)
{
if (((HttpContext.Current.Request.Cookies != null) && (HttpContext.Current.Request.Cookies[strName] != null)))
{
return HttpContext.Current.Request.Cookies[strName].Value;
}
return "";
} #endregion }

session操作类的更多相关文章

  1. C#语法糖之 session操作类 asp.net

    用法: //声名一个数据集合 var listString = new List<string>() { "a", "b", "c&quo ...

  2. C# Session 操作类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  3. Session帮助类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...

  4. C#操作session的类实例

    本文实例讲述了C#操作session的类.分享给大家供大家参考.具体分析如下: 这个C#类对session操作进行了再次封装,可以大大简化session的常用操作,同时这个类可以将session值设置 ...

  5. C#语法糖之 cache操作类 asp.net

    因为考虑到我下面我将写session cookies 等 操作类 ,与cache具有共性. 所以都统一继承了IHttpStorageObject  abstract class 来保函数风格的统一 , ...

  6. php redis数据库操作类

    <?php namespace iphp\db; use iphp\App; /** * redis操作类 * 说明,任何为false的串,存在redis中都是空串. * 只有在key不存在时, ...

  7. php-redis 操作类 封装

    <?php /** * redis操作类 * 说明,任何为false的串,存在redis中都是空串. * 只有在key不存在时,才会返回false. * 这点可用于防止缓存穿透 * */ cla ...

  8. C# 文件操作类大全

      C# 文件操作类大全 时间:2015-01-31 16:04:20      阅读:1724      评论:0      收藏:0      [点我收藏+] 标签: 1.创建文件夹 //usin ...

  9. 封装php redis缓存操作类

    封装php redis缓存操作类,集成了连接redis并判断连接是否成功,redis数据库选择,检测redis键是否存在,获取值,写入值,设置生存时间和删除清空操作. php redis类代码: &l ...

随机推荐

  1. java.lang.NoSuchFieldError: No static field abc_ic_ab_back_mtrl_am_alpha of type I in class Landroid/support/v7/appcompat/R$drawable

    出现java.lang.NoSuchFieldError: No static field abc_ic_ab_back_mtrl_am_alpha of type I in class Landro ...

  2. 关于Unity的两种调试方法

    Unity的两种调试方法 1.Debug.Log()输出语句调试,平时经常用这个 2.把MonoDevelop和Unity进行连接后断点调试 先把编辑器选择为MonoDevelop,Edit----& ...

  3. linux选择sdb sdb4 fat32 还是sda分区

    fat32是怎么混到它们中的sda,sdb,sdc是你的第一块,第二块,第三块硬盘sda1,sda2,sda5是你第一块硬盘中的第一块分区,2块,5块分区fat32,ext2,ext3,ext4是你的 ...

  4. hosts 不启作用的解决办法

    查各种编码ANSI flushdns无用 停止DNS Client  服务  0.0

  5. 从浏览器中输入URL到页面加载的发生了什么-转载

    转:https://www.cnblogs.com/confach/p/10050013.html 背景 “从浏览器中输入URL到页面加载的发生了什么“,这是一道经典的面试题,涉及到的知识面非常多,但 ...

  6. Mysql 查看连接数,状态 最大并发数 && 怎么设置才合理

    show status like '%max_connections%'; ##mysql最大连接数 set global max_connections=1000 ##重新设置 show varia ...

  7. python模块和类的通用转换规则(2),三步转oo

    介绍模块和类怎么互相转换,不谈面向对象的继承 封装 多态等特点. 一个person_module模块,有人的基本属性和功能. person_module.py如下 # coding=utf8 name ...

  8. 启动mysqld报 mysql the server quit without updating pid file

    查看mysql服务器的错误日志有一句: InnoDB: mmap(137363456 bytes) failed; errno 12 原来是内存不够用(需要131MB)呀,把my.cnf中的innod ...

  9. Linux上强制踢出其他正在登录的用户

    一.查看当前在线用户有几个 w命令 [root@pa1 nginx]#w 13:36:00 up 79 days, 23:50, 3 users, load average: 0.10, 0.07, ...

  10. ERP项目实施记录01

    工厂8月中与某ERP服务商签约,至今已经过去4个月,顾问服务了13人天,进行了10次培训. 内部产生项目文档1个:物料编码方案 制度:0个 流程:无 因ERP服务商不是针对本行业的,在BOM和生产计划 ...