.NET 表单身份验证 cookie 无法在其他应用程序中访问
我有一个使用标准 .NET 表单身份验证 cookie 的应用程序,现在我需要从托管在同一域上的应用程序获取此 cookie,但在一个文件夹下有它自己的应用程序。
我似乎无法使用 Request.Cookies.AllKeys 找到 cookie 的任何痕迹,一定有原因,因为当我检查 cookie 的详细信息时,它仍然存在,并且路径设置为“/ “这意味着我应该能够访问它?
任何帮助将不胜感激。
I have one application which uses the standard .NET forms authentication cookie, now I need to get this cookie from an application hosted on the same domain but one folder down with it's own application.
I can't seem to find any trace of the cookie using Request.Cookies.AllKeys, there must be a reason why because when I check to see what the details of the cookie are it is still there and the path is set to "/" which means I should be able to access it?
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 asp.net 中,您需要确保每个域上的机器密钥都相同,并且 cookie 使用相同的名称。 仅当您位于同一域时,身份验证才有效。
Within asp.net you need to make sure that the machine keys are the same on each domain, and also the cookie uses the same name. Authentication only works if you are on the same domain.