什么是 ASPXAUTH cookie? [英] what is ASPXAUTH cookie?

查看:21
本文介绍了什么是 ASPXAUTH cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 ASP.Net 表单身份验证时,我遇到了 .ASPXAUTH cookie.我有几个问题:

While working with ASP.Net Forms Authentication I came across the .ASPXAUTH cookie. I have a couple questions:

  • 此 cookie 的用途是什么?
  • 此 cookie 的位置是什么?

推荐答案

ASPXAUTH cookie 用于确定用户是否通过身份验证.

The ASPXAUTH cookie is used to determine if a user is authenticated.

至于 cookie 的位置,这取决于您的浏览器.如果您使用 Firefox,您可以通过单击工具 -> 选项 -> 隐私来查看 cookie.然后向下滚动到域并展开它以查看 cookie 及其值.该值使用机器密钥(位于服务器的 machine.config 或 web.config 文件中)加密,因此查看客户端上的 cookie 不会真正为您提供任何信息.您可以使用以下方法解密/查看服务器端的值:

As far as the location of the cookie, that depends on your browser. If you are using Firefox you can view the cookie by clicking on Tools -> Options -> Privacy. Then scroll down to the domain and expand it to see the cookie and its value. The value is encrypted using the machine key (located in the server's machine.config or web.config file) so looking at the cookie on the client won't really provide you any information. You can decrypt/view the value on the server side using:

HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];//.ASPXAUTH
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

其中 authTicket 有这些字段:

ASPXAUTH 基本上用于维护 ASP.NET 会话状态"的说法是错误的.ASP.NET 发出一个完全不同的 cookie,名为 ASP.NET_SessionId,以跟踪会话状态.

The statement "ASPXAUTH is basically used to maintain ASP.NET Session State" is incorrect. ASP.NET issues an entirely different cookie, named ASP.NET_SessionId, to track session state.

这篇关于什么是 ASPXAUTH cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆