gpt4 book ai didi

c# - FormsAuthentication.FormsCookiePath

转载 作者:太空宇宙 更新时间:2023-11-03 22:27:20 27 4
gpt4 key购买 nike


第一季度我读过,在设置身份验证 cookie 的超时时,我们应该记住,cookie 持续的时间越长,cookie 被盗用和滥用的可能性就越大。


A) 但是假设我们通过为整个应用程序启用 SSL 来保护我们的应用程序免受重放攻击,并且由于表单例份验证模块也在身份验证 cookie 中加密身份验证数据,那么我认为这个 cookie 没有被滥用的机会,因此保留更长时间的 cookie 应该不会带来任何安全风险?!


第二季度

FormsAuthentication.FormsCookiePath 指定身份验证 cookie 的存储位置。默认值为“/”。

A) 假设使用默认值 '/',那么 cookie 保存在哪里?

B) 此选项是否仅用于持久性 cookie?


谢谢

最佳答案

2A cookie路径是cookie关联的服务器上的路径,不是cookie存放的路径。

来自 http://www.quirksmode.org/js/cookies.html

The path gives you the chance to specify a directory where the cookie is active. So if you want the cookie to be only sent to pages in the directory cgi-bin, set the path to /cgi-bin. Usually the path is set to /, which means the cookie is valid throughout the entire domain. This script does so, so the cookies you can set on this page will be sent to any page in the www.quirksmode.org domain (though only this page has a script that searches for the cookies and does something with them).

您正在使用 ASP.Net。另请参阅“CookieLess” session 和身份验证选项,例如 http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.formscookiepath.aspx如果您担心 cookie。这会使用 URL session ID 来跟踪您的 session 。

您还可以使用 SQL Server 来跟踪 session 状态或状态服务器。例如

<sessionState mode="SQLServer" sqlConnectionString="SQLSessionDB" cookieless="false" timeout="65" cookieName="MSESSID"/>

1A。 SSL 加密传输。因此,您的 cookie 在前往客户或返回客户的途中被盗的可能性较小。这并不意味着客户端计算机上的恶意程序无法窃取它。但这不太可能。

关于c# - FormsAuthentication.FormsCookiePath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/879321/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com