Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 MVC 3 网站上实现一个简单的安全区域。我不能使用 cookie,也不能在 URL 中传递会话 ID。ASP.NET 中还有其他实现的选项吗?
PS我知道在其他环境中是可能的。
亚瑟
如果您不使用 cookie 并且不想在 URL 中传递任何内容(或 POST 请求中的隐藏字段),您的服务器根本无法区分用户。不要忘记 HTTP 是一种无状态协议。您可以实现某种自定义 HTTP 标头,这些标头将随每个请求一起发送,并允许您跟踪用户,但是当您考虑时:这正是 cookie 所做的,因此与其重新发明轮子,不如使用 cookie :-)