1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Web;
- namespace CP.Common
- {
- public static class SessionUtil
- {
-
-
-
-
-
- public static void Insert(string strSessionName, string strValue)
- {
- HttpContext.Current.Session[strSessionName] = strValue;
- HttpContext.Current.Session.Timeout = 20;
- }
-
-
-
-
-
- public static void Inserts(string strSessionName, string[] strValues)
- {
- HttpContext.Current.Session[strSessionName] = strValues;
- HttpContext.Current.Session.Timeout = 20;
- }
-
-
-
-
-
-
- public static void Insert(string strSessionName, string strValue, int iExpires)
- {
- HttpContext.Current.Session[strSessionName] = strValue;
- HttpContext.Current.Session.Timeout = iExpires;
- }
-
-
-
-
-
-
- public static void Inserts(string strSessionName, string[] strValues, int iExpires)
- {
- HttpContext.Current.Session[strSessionName] = strValues;
- HttpContext.Current.Session.Timeout = iExpires;
- }
-
-
-
-
-
- public static string Read(string strSessionName)
- {
- if (HttpContext.Current.Session[strSessionName] == null)
- {
- return null;
- }
- else
- {
- return HttpContext.Current.Session[strSessionName].ToString();
- }
- }
-
-
-
-
-
- public static string[] Reades(string strSessionName)
- {
- if (HttpContext.Current.Session[strSessionName] == null)
- {
- return null;
- }
- else
- {
- return (string[])HttpContext.Current.Session[strSessionName];
- }
- }
-
-
-
-
- public static void Remove(string strSessionName)
- {
- HttpContext.Current.Session[strSessionName] = null;
- }
- }
- }
|