关于 HttpCookie 的问题
我需要生成一个具有秘密值的 cookie,我是唯一知道它的人。
想法?
更新
我有一个处理程序页面,我调用此页面以使用 Ajax 获取 RSSFeed 的每个人都可以使用该页面。我需要做的是防止其他人伪造 HttpRequest 并获取返回的数据我尝试使用身份验证表单,但也没有什么好处我听说过随机数令牌的东西,但我不知道如何使用它。 !
更新2
阅读这这正是我的问题..
I need to generate a cookie that has a secret value which I am the only one to know it .
Ideas ?
UPDATE
I have a handler page which is available for everyone I call this page to get RSSFeed using Ajax . What I need to do is preventing other people from forging HttpRequest and get the data returned I've tried to use Authentication forms but no good also I heared about nonce token stuffs but I have no Idea how to use it . !
UPDATE2
Read This this exactly my problem ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,将敏感信息存储在 cookie 中是一个坏主意,但您可以使用仅在客户端未使用 cookie 时服务器才知道的密钥对其进行加密。您可以使用
AesManaged
类对其进行加密,并将密钥存储在安全的地方,例如具有锁定 ACL 的文件。以下是如何执行此操作的示例。
我再次强调,不应鼓励将敏感信息存储在 cookie 中。如果您将问题更新为您想要完成的任务,也许有一个更合理的解决方案。
Generally storing sensitive information in a cookie is a bad idea, but you could encrypt it with a key that is only known to the server if the cookie isn't being used client-side. You can use the
AesManaged
class to encrypt it, and store the Key somewhere safe, such as a file with locked down ACLs.Here is an example of how to do so.
Again, I would stress that storing sensitive information in a cookie is a practice that should be discouraged. If you update your question to what you are trying to accomplish, perhaps there is a more reasonable solution.