如何在ASP .NET中修复会话令牌长度 [英] How do I fix session token length in ASP .NET

查看:69
本文介绍了如何在ASP .NET中修复会话令牌长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助在asp页面中将会话令牌长度设置为32位,我该怎么做?

解决方案

参考 - SessionIDManager类 [ ^ ]。

Quote:

SessionIDManager 类是一个HTTP模块,用于管理使用的唯一会话标识符与ASP.NET会话状态。 ASP.NET会话的唯一标识符是 SessionID 属性,可以从 访问当前 HttpContext 属性> 或 页面 。 ASP.NET会话标识符是一个随机生成的数字,编码为24个字符的字符串,由a到z的小写字符和0到5的数字组成。



另外参考 - 会话ID不够随机 - ASP.NET [ ^ ]。

Quote:

如果你想要一个更好的随机会话id你可以在SessionIDManager中使用RandomNumberGenerator,例如RNGCryptoServiceProvider,并填充一堆字节(比如32位,即256位),然后用Base64编码它们


I need a help for Setting a session token length as 32 bit in asp page ,how can i make that?

解决方案

Refer - SessionIDManager Class[^].

Quote:

The SessionIDManager class is an HTTP module that manages unique session identifiers for use with ASP.NET session state. The unique identifier for an ASP.NET session is the SessionID property, which can be accessed from the Session property of the current HttpContext or Page. The ASP.NET session identifier is a randomly generated number encoded into a 24-character string consisting of lowercase characters from a to z and numbers from 0 to 5.


Also refer - Session ID not random enough - ASP.NET[^].

Quote:

If you want a better random session id you can use a RandomNumberGenerator such as RNGCryptoServiceProvider in your SessionIDManager and fill a bunch of bytes (say 32 which is 256 bits), then encode them using Base64


这篇关于如何在ASP .NET中修复会话令牌长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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