惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
WordPress大学
WordPress大学
小众软件
小众软件
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
A
About on SuperTechFans
月光博客
月光博客
F
Fortinet All Blogs
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
V2EX
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
Jina AI
Jina AI
博客园 - 聂微东
Schneier on Security
Schneier on Security
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
N
News | PayPal Newsroom
PCI Perspectives
PCI Perspectives
Last Week in AI
Last Week in AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Proofpoint News Feed
Hacker News: Ask HN
Hacker News: Ask HN
B
Blog
aimingoo的专栏
aimingoo的专栏
P
Privacy International News Feed
Martin Fowler
Martin Fowler
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - 叶小钗
N
News and Events Feed by Topic
T
The Exploit Database - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
S
Security @ Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threatpost
IT之家
IT之家
B
Blog RSS Feed

博客园 - 克仔

克仔嘅第一次。。。“浮潜” Exact ADC之Paintball大戦 - 克仔 - 博客园 .NET Compact Framework里的DateTimePicker Control显示錯误的month selection list .NET CF v1的Form.ShowDialog(Me)里的Me在不能用了! .NET CF里的toolbar image在Windows Mobile 2003 SE消失了。 先嚟為《達文西的密碼》電影熱熱身。 汽油起價 - 加油站車龍。 我嘅第一部O2 Xda ll mini 《達文西的密碼》登上大银幕 Single Instance Appplication in .NET CF 丹•布朗 《數字城堡》 全新ARM base PocketPC 2003 Emulator Beta 已登場。 向左走,向右走? 全新旅途。。。 如何在ASP.NET里用HtmlInputFile控件来上载文件。 達文西的密碼 - 後記。 達文西的密碼。 如何用DataSet.GetChanges来提升数据库资料更新效率。 如何用SqlConnection类的InfoMessage事件来显示Stored Procedure的PRINT讯息。 Deamon Tool
如何用ASP.NET里的State Management Database来储存Session Variable。
克仔 · 2005-04-14 · via 博客园 - 克仔

(華版)

很多人都会在地一时间里想到用Cookies(HttpCookies)来储存某些资料;以便在游览到另一个WebForm时,依然能够从用户端读取所储存的资料。但是,万一如果用户的游览器不容许Cookies。。。那就不是完了吗。。。更何况Cookies只能容纳4K Byte的资料而且!

所以就要改用server side的SQL数据库方式而放弃client side的Cookies;更何况用SQL数据库是非常简单,只需安装.NET Framework所提供的InstallSqlState.sql script和修改一下Web.Config文件就行了。其它就如平常写Session变量一模一样。

InstallSqlState.sql可以在 C:\WINDOWS\Microsoft.NET\Framework\(版本号码)\ 文件夹里找到。

以下就是需要修改的Web.Config里的sessionState属性:

把原有的
  1. mode=InProc改去mode=SQLServer。
  2. 修改sqlConnectionString字符串,但是在这里不用填写Initial Catalog。因为AspState是默人Catalog,
      也就InstallSqlState.sql所安装的ASP State Management database。
  3. 把timeout修改去你想要的session expire值;timeout的单位以分钟来计算。
  4. cookieless="false"代表SesionID容纳在URL里,比如http://server/(SessionID)/Sample.aspx
      所以,此属性的值一般都是false。

        Dim time As DateTime = DateTime.Now
        Session(
"Time"= time.ToString())