SessionHelper2.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System.Web;
  2. namespace Ant.Service.Utilities
  3. {
  4. //public static class SessionHelper2
  5. //{
  6. // /// <summary>
  7. // /// 添加Session,调动有效期为20分钟
  8. // /// </summary>
  9. // /// <param name="strSessionName">Session对象名称</param>
  10. // /// <param name="strValue">Session值</param>
  11. // public static void Add(string strSessionName, string strValue)
  12. // {
  13. // HttpContext.Current.Session[strSessionName] = strValue;
  14. // HttpContext.Current.Session.Timeout = 20;
  15. // }
  16. // /// <summary>
  17. // /// 添加Session,调动有效期为20分钟
  18. // /// </summary>
  19. // /// <param name="strSessionName">Session对象名称</param>
  20. // /// <param name="strValues">Session值数组</param>
  21. // public static void Adds(string strSessionName, string[] strValues)
  22. // {
  23. // HttpContext.Current.Session[strSessionName] = strValues;
  24. // HttpContext.Current.Session.Timeout = 20;
  25. // }
  26. // /// <summary>
  27. // /// 添加Session
  28. // /// </summary>
  29. // /// <param name="strSessionName">Session对象名称</param>
  30. // /// <param name="strValue">Session值</param>
  31. // /// <param name="iExpires">调动有效期(分钟)</param>
  32. // public static void Add(string strSessionName, string strValue, int iExpires)
  33. // {
  34. // HttpContext.Current.Session[strSessionName] = strValue;
  35. // HttpContext.Current.Session.Timeout = iExpires;
  36. // }
  37. // /// <summary>
  38. // /// 添加Session
  39. // /// </summary>
  40. // /// <param name="strSessionName">Session对象名称</param>
  41. // /// <param name="strValues">Session值数组</param>
  42. // /// <param name="iExpires">调动有效期(分钟)</param>
  43. // public static void Adds(string strSessionName, string[] strValues, int iExpires)
  44. // {
  45. // HttpContext.Current.Session[strSessionName] = strValues;
  46. // HttpContext.Current.Session.Timeout = iExpires;
  47. // }
  48. // /// <summary>
  49. // /// 读取某个Session对象值
  50. // /// </summary>
  51. // /// <param name="strSessionName">Session对象名称</param>
  52. // /// <returns>Session对象值</returns>
  53. // public static string Get(string strSessionName)
  54. // {
  55. // if (HttpContext.Current.Session[strSessionName] == null)
  56. // {
  57. // return null;
  58. // }
  59. // else
  60. // {
  61. // return HttpContext.Current.Session[strSessionName].ToString();
  62. // }
  63. // }
  64. // /// <summary>
  65. // /// 读取某个Session对象值数组
  66. // /// </summary>
  67. // /// <param name="strSessionName">Session对象名称</param>
  68. // /// <returns>Session对象值数组</returns>
  69. // public static string[] Gets(string strSessionName)
  70. // {
  71. // if (HttpContext.Current.Session[strSessionName] == null)
  72. // {
  73. // return null;
  74. // }
  75. // else
  76. // {
  77. // return (string[])HttpContext.Current.Session[strSessionName];
  78. // }
  79. // }
  80. // /// <summary>
  81. // /// 删除某个Session对象
  82. // /// </summary>
  83. // /// <param name="strSessionName">Session对象名称</param>
  84. // public static void Del(string strSessionName)
  85. // {
  86. // HttpContext.Current.Session[strSessionName] = null;
  87. // }
  88. //}
  89. }