zoukankan
html css js c++ java
按照选定时间保存cookie
前台:
<
asp:dropdownlist
id
="remrember"
runat
="server"
>
<
asp:ListItem
Value
="0"
Selected
="True"
>
不保存
</
asp:ListItem
>
<
asp:ListItem
Value
="1"
>
保存一天
</
asp:ListItem
>
<
asp:ListItem
Value
="30"
>
保存一月
</
asp:ListItem
>
<
asp:ListItem
Value
="365"
>
保存一年
</
asp:ListItem
>
</
asp:dropdownlist
>
后台:
public
void
AddLoginCookie(
int
day)
{
HttpCookie cookie
=
new
HttpCookie(
"
remrember
"
);
cookie.Values.Add(
"
userName
"
,Session[
"
userName
"
].ToString());
cookie.Expires
=
DateTime.Now.AddDays(day);
Response.AppendCookie(cookie);
}
使用:
if
(remrember.SelectedValue
!=
"
0
"
)
AddLoginCookie(Convert.ToInt32(remrember.SelectedValue));
查看全文
相关阅读:
假脱机技术
HTTP报文
字符串转换成浮点数的方法
表变量与临时表空间
规范浮点数
什么是批处理
浅谈性能测试、压力测试和负载测试
关于CSDN的一个安全漏洞
HttpWatch7.0测试工具
vbscript能做什么
原文地址:https://www.cnblogs.com/xiaodi/p/120539.html
最新文章
注册jdbc驱动程序的三种方式
Eclipse快捷键大全
DWR框架应用简单例子
Hibernate 参数设置一览表
使用dom4j向xml任意指定位置插入节点
JSDOM Element方法和属性
主流数据库比较
关于树的递归和迭代遍历方法
网速变慢深度分析:面试
进程表/文件表/inode/vnode
热门文章
printf函数%f输出int
僵尸进程ZOMBIE
Linux重定向
判断链表是否相交
SQL书写规则30例
操作系统分类详解
字符串/数组旋转问题
order by与索引
c语言中结构体的对齐
80X86寄存器详解
Copyright © 2011-2022 走看看