利用状态存储一些常用数据提升网站效率。
利用状态存储用户信息使得网站能记住用户。
利用状态存储在网站的各个页面中传递数据
|
存储位置 |
类型 限制 |
大小 限制 |
适用 对象 |
使用 范围 |
过期 策略 |
安全性 |
Cookie |
客户端Cookie文件夹 |
字符串 |
每个4K |
单个用户 |
当前请求 上下文 |
绝对时 间过期 |
低 |
Session-InProc |
客户端Cookie和Web服务器内存 |
任何 类型 |
受内存 限制 |
单个用户 |
当前请求 上下文 |
平滑时 间过期 |
比较高 |
Session-StateServer |
客户端Cookie和 Windows服务所在服务器内存 |
可序列 化类型 |
受内存 限制 |
单个用户 |
当前请求 上下文 |
平滑时 间过期 |
比较高 |
Session-SqlServer |
客户端Cookie和SQL Server服务器硬盘 |
可序列 化类型 |
受数据 库限制 |
单个用户 |
当前请求 上下文 |
平滑时 间过期 |
比较高 |
Application |
Web服务器内存 |
任何 类型 |
受内存 限制 |
所有用户 |
当前请求 上下文 |
应用程 序结束 则无效 |
高 |
Cache |
Web服务器内存 |
任何 类型 |
受内存 限制 |
所有用户 |
当前请求 上下文 |
平滑时间 过期、绝 对时间过 期、依赖 过期 |
高 |
ViewState |
页面隐藏域 |
可序列 化类型 |
受表单 提交大 小限制 |
单个用户 |
当前页面 |
页面关 闭则无 效 |
比较低 |
Profile |
客户端Cookie和数据库 |
可序列 化类型 |
受数据 库限制 |
单个用户 |
当前请求 上下文 |
Cookie 过期时 间或者长 期存在 |
比较高 |
Querystring |
页面URL |
字符串 |
不超过 2K |
单个用户 |
当前页面 |
页面关闭 则无效 |
低 |