为什么不使用System.Security.Cryptography中的加密功能对敏感的cookie名称和值进行加密和解密?您可以编写一些实用程序功能来轻松管理它。实用程序功能示例:
private static void SetEncryptedcookie(string name, string value){ var encryptName = SomeEncryptionMethod(name); Response.cookies[encryptName].Value = SomeEncryptionMethod(value); //set other cookie properties here, expiry &c. //Response.cookies[encryptName].Expires = ...}private static string GetEncryptedcookie(string name){ //you'll want some checks/exception handling around this return SomeDecryptionMethod( Response.cookies[SomeDecryptionMethod(name)].Value);}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)