Basic settings of session:
using System; using ; using ; using ; using ; namespace OAFrameWork { public class CSession { public static object Get(string Key) { return [Key]; } public static string GetString(string Key) { object obj = [Key]; if (obj == null) return ""; else return (); } public static object Get(string Key,object DefaultValue) { if ([Key] == null) return DefaultValue; else return [Key]; } public static object Get(string Key, object DefaultValue,Boolean CanAdd) { if ([Key] == null) { if(CanAdd==true) (Key, DefaultValue); return DefaultValue; } else return [Key]; } public static Boolean Set(string Key,object Value) { try { if (Value == null && [Key] != null) { (Key); } else if ([Key] == null) { (Key, Value); } else { [Key] = Value; } return true; } catch (Exception ex) { (); return false; } } } }
Clear Session:
();//Clear all Sessions//Clear a SessionSession["UserName"] = null; ("UserName");