如何在.NET登录后更改sessionid?(How to change sessionid after login in .NET?)
出于安全原因,我想在登录后更改session_id。 在php中,有一个函数session_regenerate_id(); 这可以改变sessionid而不会丢失当前的会话信息。
.NET中有类似的功能吗?
For security reasons, I want to change session_id after login. In php, there's a function session_regenerate_id(); which can change sessionid without losing current session information.
Is there a similar function in .NET ?
最满意答案
ASP.NET不直接支持重新生成会话ID的功能。 请参阅有关该问题的文档。 通过将ASPNET_SessionID值设置为空字符串并重定向以便重新生成值,有一种不那么快速和脏的方法 。
ASP.NET does not directly support functionality to regenerate a session ID. See the documentation regarding the issue. There is a not-so quick and dirty way to do it by setting the ASPNET_SessionID value to the empty string and redirecting so that the value is regenerated.
更多推荐
发布评论