为每次登录尝试添加一个随机更改的新cookie [英] add a new cookie that randomly changes for each login attempt

查看:215
本文介绍了为每次登录尝试添加一个随机更改的新cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要为每次登录尝试添加一个随机更改的新cookie。我需要在成功验证之前和之后生成不同的会话ID。此外,成功验证后的每个请求都应与一个额外的会话标识符cookie相关联,当用户从应用程序注销或关闭浏览器时,该cookie随机更改并过期。



谢谢

Hi all,

I need to add a new cookie that randomly changes for each login attempt. I need to generate different session id before and after the successful authentication. Also every request after the successful authentication should be associated with an extra session identifier cookie which also randomly changes and expire when user logs out from the application or closes the browser.

Thanks

推荐答案

根据我的理解,对于在身份验证上执行的每个操作,您都需要不同的会话ID。如果是这样,您可以使用GUID类生成随机值并将其存储在cookie或会话中。
As per my understand, you are required different session Id's for each operation performed on the authentication. If it so, you can use "GUID" class to generate a random value and store it either in the cookie or session.


这篇关于为每次登录尝试添加一个随机更改的新cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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