首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

如何根据session id获得session的值呢

2012-03-16 
怎么根据session id获得session的值呢怎么根据session id获得session的值呢[解决办法]思路是这样的:Sessio

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

[解决办法]
思路是这样的:
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
[解决办法]
string s = Session["SessionID"].ToString();

Type x = (Type)Session["SessionID"];
其中Type为SessionID中记录的数据的类型

热点排行