using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace Pub.Class
{
/// <summary>
/// Session操作类
/// </summary>
public class Session2
{
#region Set
/// <summary>
/// 设置Session值
/// </summary>
/// <param name="InfoName">Session名称</param>
/// <param name="InfoValue">Session名称对应的值</param>
static public void Set(String InfoName, String InfoValue) {
string key = "9cf8d21d394a8919d2f9706dfdc6421e";
InfoName
= (key + InfoName).MD5();
InfoValue
= InfoValue.DESEncode(key);

HttpContext.Current.Session[InfoName]
= InfoValue;

if (InfoValue.Length == 0) HttpContext.Current.Session.Remove(InfoName);
}
#endregion

#region Get
/// <summary>
/// 取Session值
/// </summary>
/// <param name="InfoName">Session名称</param>
/// <returns>Session名称对应的值</returns>
static public String Get(String InfoName) {
string _Value = string.Empty;
string key = "9cf8d21d394a8919d2f9706dfdc6421e";
InfoName
= (key + InfoName).MD5();
if (HttpContext.Current.Session[InfoName] != null) { _Value = Convert.ToString(HttpContext.Current.Session[InfoName]); _Value = _Value.DESDecode(key); }
return _Value;
}
#endregion
}
}

相关文章:

  • 2021-09-16
  • 2022-01-04
  • 2022-01-01
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-22
  • 2022-01-15
  • 2021-06-07
  • 2022-12-23
  • 2021-09-15
  • 2022-01-14
  • 2021-05-24
相关资源
相似解决方案