In ASP.NET 3.5, is it possible to iterate through all of the session objects (not the objects within the current session, but all sessions across all users) so that their collection contents can be manipulated (i.e. one collection item removed from all active sessions)?
在ASP.NET 3.5中,是否可以遍历所有会话对象(不是当前会话中的对象,而是遍历所有用户的所有会话),以便可以操纵其集合内容(即,从所有活动中删除一个集合项会议)?
And if so, does this work with ASP.NET State Service (accessing all sessions created by all web servers that are sharing the same state service, all from one web server)?
如果是这样,这是否适用于ASP.NET状态服务(访问由共享相同状态服务的所有Web服务器创建的所有会话,所有这些都来自一个Web服务器)?
2 个解决方案
#1
This answer to a question I asked about removing a session from another session may be helpful to you. I haven't tried it and you'd need to extend it, but it appears possible to access the container for all sessions using reflection.
对于我从另一个会话中删除会话的问题的答案可能对您有所帮助。我没有尝试过,你需要扩展它,但似乎可以使用反射访问所有会话的容器。
#2
I think the only answer I've come up with is: If you're working with a single box, you can put the sessions into a collection that is stored in the Application collection, and remove each session when each session ends. But for making global session updates to a shared state server, credit goes to tvanfosson's comment under one of the other answers: SQL Server is the only reasonably viable option, outside of using a third party or alternate state server that enables this feature via network sockets.
我认为我提出的唯一答案是:如果您正在使用单个框,则可以将会话放入存储在Application集合中的集合中,并在每个会话结束时删除每个会话。但是为了对共享状态服务器进行全局会话更新,可以在其他一个答案中获得tvanfosson的评论:SQL Server是唯一合理可行的选项,除了使用通过网络套接字启用此功能的第三方或备用状态服务器之外。
#1
This answer to a question I asked about removing a session from another session may be helpful to you. I haven't tried it and you'd need to extend it, but it appears possible to access the container for all sessions using reflection.
对于我从另一个会话中删除会话的问题的答案可能对您有所帮助。我没有尝试过,你需要扩展它,但似乎可以使用反射访问所有会话的容器。
#2
I think the only answer I've come up with is: If you're working with a single box, you can put the sessions into a collection that is stored in the Application collection, and remove each session when each session ends. But for making global session updates to a shared state server, credit goes to tvanfosson's comment under one of the other answers: SQL Server is the only reasonably viable option, outside of using a third party or alternate state server that enables this feature via network sockets.
我认为我提出的唯一答案是:如果您正在使用单个框,则可以将会话放入存储在Application集合中的集合中,并在每个会话结束时删除每个会话。但是为了对共享状态服务器进行全局会话更新,可以在其他一个答案中获得tvanfosson的评论:SQL Server是唯一合理可行的选项,除了使用通过网络套接字启用此功能的第三方或备用状态服务器之外。