怎么根据session id获得session的值呢

zhangflyfly 2009-02-03 08:42:27
怎么根据session id获得session的值呢
...全文
460 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jintianhu2000 2011-03-24
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ivy_zheng 的回复:]
string s = Session["SessionID"].ToString();

Type x = (Type)Session["SessionID"];
其中Type为SessionID中记录的数据的类型
[/Quote]
你知道LZ问的是啥不?
最后一只恐龙 2009-02-03
  • 打赏
  • 举报
回复
string s = Session["SessionID"].ToString();

Type x = (Type)Session["SessionID"];
其中Type为SessionID中记录的数据的类型
宝_爸 2009-02-03
  • 打赏
  • 举报
回复
思路是这样的:
Sessions are sandboxed, and can't access one another. However,
they can all access Application Scope. So Application is wehre you can put
some reference to a Session. You still can't actually access the Session
there, though.

Perhaps the best thing would be to put a Collection into the Application
Cache, and emulate Sessions there. The Session_Start method could create a
member of that Collection in the Application, and identify it with the
unique SessionID that the Session generates, which could then be used to
access the element in the Collection that "stands for" that Session.


可以参考下面的代码.在Session_Start中将Session记录到全局变量中.
How to get detailed info about all online visitors that are currently browsing your ASP.NET website?
http://www.aspdotnetfaq.com/Faq/How-to-get-detailed-info-about-all-online-visitors-that-are-currently-browsing-your-ASP-NET-website.aspx
zhangflyfly 2009-02-03
  • 打赏
  • 举报
回复
自己顶!!!!!!!!!

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧