简体   繁体   中英

How can I destroy Session by SessionId from different web application in asp.net?

如何在网格视图上创建一个名为Kill Session的按钮以为C#asp.net Web表单中的用户Kill Session

The naive answer is to have each request check a persistent queue or table of such pending "session kills" before any processing, and conditionally abandon the session.

A quick optimization is to have the application listen globally (ie from appstart) and actively to the external queue, so that "kill requests" can be pushed to it immediately. You can then prepare them in a local thread-safe data structure so that normal HTTP requests aren't slowed down.

Your session management application simply sends messages to that queue.

Sidenote: Any "service bus" will do usually. It is rather important than the queue be persistent as you need to handle scenarios revolving around the application restarting while messages are queued up.

The proper answer is to communicate directly with the actual session handler. I don't believe there are any standard APIs to do what you want, so this will depend on the session handler (and likely on the host/server).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM