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));
查看全文
相关阅读:
Math对象
MDN中的对象原型
构造函数的静态成员和实例成员
js对象的九大特点
对象数据的使用方法
创建对象的所有方式
Linux下gcc编译器的使用
Linux vim环境设置
Linux下is not in the sudoers file解决方法
mySQL相关函数的使用
原文地址:https://www.cnblogs.com/xiaodi/p/120539.html
最新文章
Arduino ESP8266 HC06
Arduino ESP8266 引脚详解
MySQL window10安装
Python Django url路径自动添加问题(末尾自动添加/)
Python Django REST framework 中文文档
C getchar()的使用
Arduino ESP32 ESP8266 自动重启
Jetbrains Windows Defender might be impacting your build performance----解决方案
nginx 错误, flume 集锦,太多bugs netstat -ntpl
透过面试题,洞察Hbase 核心知识点
热门文章
大数据,云计算 核心体系
Story share IBM 一同事职业发展履历
hbase的调优
SQuirrel 连不上 Phoenix Hbase ---> 可能是因为zookeeper 集群中的一个zookeeper 启动有问题
How Hbase store data in HDFS 数据在Hbase上的存储形式,Hbase 知识点概述
Java API 操作Hbase
Phoenix ,SQuirrel 与Hbase 搭建
readonly
AMD和CMD
iframe
Copyright © 2011-2022 走看看