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

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

博客园 - 克仔

克仔嘅第一次。。。“浮潜” 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())