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. python3二元Logistics Regression 回归分析(LogisticRegression)

    纲要 boss说增加项目平台分析方法: T检验(独立样本T检验).线性回归.二元Logistics回归.因子分析.可靠性分析 根本不懂,一脸懵逼状态,分析部确实有人才,反正我是一脸懵 首先解释什么是二 ...

  2. IOC容器特性注入第七篇:请求上下文作用域

    Ninject的对象作用域: Transient .InTransientScope() 每次调用创建新实例. Singleton .InSingletonScope() 单例,仅创建一个实例. Th ...

  3. [Full-stack] 网页布局艺术 - Less

    故事背景 一个过程: template/html ----> css ----> less ----> bootstrap/flex ----> Semantic-ui fle ...

  4. mysql 导入excel文件数据到数据库

    load data local infile 'C:/Users/Administrator/Documents/gaunai2.csv' into table newtable (c1,c2) fi ...

  5. 用 SQLite 和 FMDB 替代 Core Data

    本文转载至 http://blog.csdn.net/majiakun1/article/details/38680147 为什么我不使用Core Data Mike Ash 写到: 就个人而言,我不 ...

  6. 八、K3 WISE 开发插件《工业单据老单插件中获取登陆用户名》

    备注:如果是BOS新单,都有获取用户名的方法.在单据有m_BillInterface.K3Lib.User.UserId,在序时薄有m_ListInterface.K3Lib.User.UserID ...

  7. 【本周面试题】第2周 - js单线程和异步相关问题

    硬性知识点考察: 为什么js是单线程的? 因为js设计最初是为了操作dom而生,如果是多线程的,当多个线程同时修改一个dom时就会产生冲突,所以设计成单线程,一次只能做一件事. 既然是单线程为什么要有 ...

  8. LeetCode - 872. Leaf-Similar Trees

    Consider all the leaves of a binary tree.  From left to right order, the values of those leaves form ...

  9. css---颜色过渡渐变

    CSS---颜色过渡渐变 <!doctype html> <html lang="en"> <head> <meta charset=&q ...

  10. hadoop的输入和输出文件

    对于hadoop的输入和输出文件,有什么要求吗?