As example, I login in to the system ad... But how can i use the session function to recall the current applicationid? Which I need to store in form and to the other table of database.. Behind code.. vb not c# Thanks a lot. Your guide is appreciate .
例如,我登录系统广告...但是如何使用会话功能来调用当前的applicationid?我需要在表单和数据库的另一个表中存储..代码后面.. vb不是c#非常感谢。您的导游很感激。
Example.. 1. Login with the session fix (userid) in virtual studio.. 2. I wanna recall it out (userid) .. How !! Problem 1 3. Fill the (userid) to other table in database. That Y ! 4. Grid view data show with specific (userid) only.. in session !! Problem 2
示例.. 1.使用虚拟工作室中的会话修复(userid)登录.. 2.我想回想一下(userid)..如何!!问题1 3.将(userid)填入数据库中的其他表。那个Y! 4.网格视图数据仅显示特定(用户ID)..在会话中!!问题2
Thank splattne !!
谢谢splattne !!
I think that show be replace the word (applicationid) to (userid) .. my mistaken... Cos after i recheck the table of aspnet_membership!!
我认为show会被替换为(userid)这个词(userid)..我的错误...... Cos重新检查aspnet_membership的表!!
2 个解决方案
#1
The ASP.NET Session isn't a function, but an object, more specifically a specialized Collection (SessionStateItemCollection) kept in memory with a timeout specified. You can insert data (other objects) in that "container" using strings as keys like "UserName", for example:
ASP.NET Session不是一个函数,而是一个对象,更具体地说是一个专门的Collection(SessionStateItemCollection),它保存在内存中并指定了超时。您可以使用字符串作为“UserName”之类的键在该“容器”中插入数据(其他对象),例如:
Session("UserName") = "billg"
You can retrieve that value the same way:
您可以使用相同的方式检索该值:
Dim UserName as String = Session("UserName")
You can find an Overview to Session State on MSDN.
您可以在MSDN上找到会话状态概述。
#2
Not sure this is what you are after but the SessionID will change event after the session starts until you actually store a value in Session. Better to come up with your own ID or SQL based identity and store that in Session.
不确定这是你所追求的,但SessionID将在会话开始后更改事件,直到您在Session中实际存储值。最好提出自己的ID或基于SQL的身份并将其存储在Session中。
#1
The ASP.NET Session isn't a function, but an object, more specifically a specialized Collection (SessionStateItemCollection) kept in memory with a timeout specified. You can insert data (other objects) in that "container" using strings as keys like "UserName", for example:
ASP.NET Session不是一个函数,而是一个对象,更具体地说是一个专门的Collection(SessionStateItemCollection),它保存在内存中并指定了超时。您可以使用字符串作为“UserName”之类的键在该“容器”中插入数据(其他对象),例如:
Session("UserName") = "billg"
You can retrieve that value the same way:
您可以使用相同的方式检索该值:
Dim UserName as String = Session("UserName")
You can find an Overview to Session State on MSDN.
您可以在MSDN上找到会话状态概述。
#2
Not sure this is what you are after but the SessionID will change event after the session starts until you actually store a value in Session. Better to come up with your own ID or SQL based identity and store that in Session.
不确定这是你所追求的,但SessionID将在会话开始后更改事件,直到您在Session中实际存储值。最好提出自己的ID或基于SQL的身份并将其存储在Session中。