ASP.NET 是否公开了用于生成会话 ID 的底层函数?我想生成一个会话令牌以在 Web 服务中使用,但它不会放入 Set-Cookie 标头中。如果 ASP.NET 已经有一个可以用来生成会话 ID 的函数,这将使我不必自己动手。
反射器 http://www.red-gate.com/products/reflector/是你的朋友:
SessionIDManager.CreateSessionID()
internal static string Create(ref RandomNumberGenerator randgen)
{
if (randgen == null)
{
randgen = new RNGCryptoServiceProvider();
}
byte[] data = new byte[15];
randgen.GetBytes(data);
return Encode(data);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)