ASPNET cookie 验证

ASPNET cookie validation

在表单身份验证中,在对 user/password 进行身份验证后,将创建一个 cookie 并将其发送到客户端计算机。任何人都可以回答以下有关验证 cookie 的问题吗?

  1. 成功登录后,aspnet 如何根据后续请求验证此客户端 cookie? aspnet 是否将 cookie 的内容与任何数据存储进行比较?
  2. 在服务器上,aspnet 在哪里维护经过身份验证的用户详细信息以验证 cookie?
  3. Cookie 中放置了哪些详细信息?
  1. FormsAuthenticationTicketFormsAuthentication.SetAuthCookie contains a string representation of the encrypted and signed FormsAuthenticationTicket object which in turn represents the authentication ticket that is used by forms authentication to identify an authenticated user. The ticket object is initialized with the associated user name, version number, expiration date, issue date, a boolean value on whether the ticket will be stored in a persistent cookie or not and any user-specific data. Check out the constructors 设置的 cookie 了解详情。除此之外,cookie 通常包含诸如其虚拟路径、关联域以及 cookie 是否应仅通过 HTTPS 连接传输等属性。

1 和 2. 在每次请求时,服务器都会查找 cookie 并解密在其中找到的身份验证票证。此外,服务器根据票据的过期值检查票据是否仍然有效。 and/or 验证不会与任何服务器端维护的数据进行任何比较。