internal HttpApplicationState () { // do not use the public (empty) ctor as it required UnmanagedCode permission _AppObjects = new HttpStaticObjectsCollection (this); _SessionObjects = new HttpStaticObjectsCollection (this); _Lock = new ReaderWriterLock (); }
public HttpSessionStateContainer(string id, ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout, bool newSession, HttpCookieMode cookieMode, SessionStateMode mode, bool isReadonly) : this(null, id, sessionItems, staticObjects, timeout, newSession, cookieMode, mode, isReadonly) { if (id == null) { throw new ArgumentNullException("id"); } }
static internal HttpStaticObjectsCollection Deserialize(BinaryReader reader) { int count; string name; string typename; bool hasInstance; Object instance; HttpStaticObjectsEntry entry; HttpStaticObjectsCollection col; col = new HttpStaticObjectsCollection(); count = reader.ReadInt32(); while (count-- > 0) { name = reader.ReadString(); hasInstance = reader.ReadBoolean(); if (hasInstance) { instance = AltSerialization.ReadValueFromStream(reader); entry = new HttpStaticObjectsEntry(name, instance, 0); } else { typename = reader.ReadString(); bool lateBound = reader.ReadBoolean(); entry = new HttpStaticObjectsEntry(name, Type.GetType(typename), lateBound); } col._objects.Add(name, entry); } return(col); }
internal HttpApplicationState() { // do not use the public (empty) ctor as it required UnmanagedCode permission _AppObjects = new HttpStaticObjectsCollection(this); _SessionObjects = new HttpStaticObjectsCollection(this); _Lock = new ReaderWriterLock(); }
public HttpStaticObjectsCollectionWrapper(HttpStaticObjectsCollection httpStaticObjectsCollection) { if (httpStaticObjectsCollection == null) { throw new ArgumentNullException("httpStaticObjectsCollection"); } _collection = httpStaticObjectsCollection; }
public SessionStateStoreData (ISessionStateItemCollection items, HttpStaticObjectsCollection objects, int timeout) { sessionItems = items; staticObjects = objects; this.timeout = timeout; }
public HttpStaticObjectsCollectionWrapper(HttpStaticObjectsCollection httpStaticObjectsCollection) { if (httpStaticObjectsCollection == null) { throw new ArgumentNullException("httpStaticObjectsCollection"); } w = httpStaticObjectsCollection; }
internal static SessionStateStoreData CreateLegitStoreData(HttpContext context, ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout) { if (sessionItems == null) sessionItems = new SessionStateItemCollection(); if (staticObjects == null && context != null) staticObjects = SessionStateUtility.GetSessionStaticObjects(context); return new SessionStateStoreData(sessionItems, staticObjects, timeout); }
public void SetUp() { var configure = new MongoConfigurationBuilder(); configure.ConnectionStringAppSettingKey("mongoserver"); config = configure.BuildConfiguration(); SessionStateItemCollection sessionItemsCollection = new SessionStateItemCollection(); HttpStaticObjectsCollection staticObjectsCollection = new HttpStaticObjectsCollection(); item = new SessionStateStoreData(sessionItemsCollection, staticObjectsCollection, 1); }
internal void Copy(ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout, bool locked, DateTime utcLockDate, int lockCookie, int flags) { this._sessionItems = sessionItems; this._staticObjects = staticObjects; this._timeout = timeout; this._locked = locked; this._utcLockDate = utcLockDate; this._lockCookie = lockCookie; this._flags = flags; }
internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection(); IDictionaryEnumerator enumerator = this._objects.GetEnumerator(); while (enumerator.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry) enumerator.Value; objectss.Add(entry.Name, entry.ObjectType, entry.LateBound); } return objectss; }
public void Serialization () { MemoryStream ms = new MemoryStream (); BinaryWriter writer = new BinaryWriter (ms); HttpStaticObjectsCollection hsoc = new HttpStaticObjectsCollection (); hsoc.Serialize (writer); ms.Position = 0; BinaryReader reader = new BinaryReader (ms); Assert.IsNotNull (HttpStaticObjectsCollection.Deserialize (reader)); }
public static HttpStaticObjectsCollection Deserialize(BinaryReader reader) { HttpStaticObjectsCollection result = new HttpStaticObjectsCollection(); for (int i = reader.ReadInt32(); i > 0; i--) { result.Set(reader.ReadString(), System.Web.Util.AltSerialization.Deserialize(reader)); } return(result); }
internal static SessionStateStoreData CreateLegitStoreData(HttpContext context, ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout) { if (sessionItems == null) { sessionItems = new SessionStateItemCollection(); } if ((staticObjects == null) && (context != null)) { staticObjects = GetSessionStaticObjects(context); } return new SessionStateStoreData(sessionItems, staticObjects, timeout); }
internal HttpSessionStateContainer(SessionStateModule stateModule, string id, ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout, bool newSession, HttpCookieMode cookieMode, SessionStateMode mode, bool isReadonly) { this._stateModule = stateModule; this._id = id; this._sessionItems = sessionItems; this._staticObjects = staticObjects; this._timeout = timeout; this._newSession = newSession; this._cookieMode = cookieMode; this._mode = mode; this._isReadonly = isReadonly; }
public TaskWaitRedisHttpSessionStateContainer(string id, RedisSessionItemHash sessionItems, HttpStaticObjectsCollection staticObjects, int timeout, bool newSession, HttpCookieMode cookieMode, SessionStateMode mode, bool isReadonly) : base(id, sessionItems, staticObjects, timeout, newSession, cookieMode, mode, isReadonly) { SessionItems = sessionItems; }
private void AddStaticObjectAssemblyDependencies(HttpStaticObjectsCollection staticObjects) { if ((staticObjects != null) && (staticObjects.Objects != null)) { IDictionaryEnumerator enumerator = staticObjects.Objects.GetEnumerator(); while (enumerator.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry) enumerator.Value; base.AddTypeDependency(entry.ObjectType); } } }
/* * Create a copy without copying instances (names and types only) */ internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection c = new HttpStaticObjectsCollection(); IDictionaryEnumerator e = _objects.GetEnumerator(); while (e.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)e.Value; c.Add(entry.Name, entry.ObjectType, entry.LateBound); } return c; }
internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection(); IDictionaryEnumerator enumerator = this._objects.GetEnumerator(); while (enumerator.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)enumerator.Value; objectss.Add(entry.Name, entry.ObjectType, entry.LateBound); } return(objectss); }
internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection(); coll._Objects = new Hashtable(); foreach (string key in _Objects.Keys) { StaticItem item = new StaticItem((StaticItem)_Objects [key]); coll._Objects [key] = item; } return(coll); }
internal HttpApplicationState(HttpStaticObjectsCollection applicationStaticObjects, HttpStaticObjectsCollection sessionStaticObjects) : base(Misc.CaseInsensitiveInvariantKeyComparer) { _applicationStaticObjects = applicationStaticObjects; if (_applicationStaticObjects == null) _applicationStaticObjects = new HttpStaticObjectsCollection(); _sessionStaticObjects = sessionStaticObjects; if (_sessionStaticObjects == null) _sessionStaticObjects = new HttpStaticObjectsCollection(); }
internal HttpApplicationState(HttpStaticObjectsCollection applicationStaticObjects, HttpStaticObjectsCollection sessionStaticObjects) : base(Misc.CaseInsensitiveInvariantKeyComparer) { this._lock = new HttpApplicationStateLock(); this._applicationStaticObjects = applicationStaticObjects; if (this._applicationStaticObjects == null) { this._applicationStaticObjects = new HttpStaticObjectsCollection(); } this._sessionStaticObjects = sessionStaticObjects; if (this._sessionStaticObjects == null) { this._sessionStaticObjects = new HttpStaticObjectsCollection(); } }
/* * Create a copy without copying instances (names and types only) */ internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection c = new HttpStaticObjectsCollection(); IDictionaryEnumerator e = _objects.GetEnumerator(); while (e.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)e.Value; c.Add(entry.Name, entry.ObjectType, entry.LateBound); } return(c); }
internal NetHttpApplicationState(HttpStaticObjectsCollection applicationStaticObjects, HttpStaticObjectsCollection sessionStaticObjects) : base(NetHttpModuleCollection.CaseInsensitiveInvariantKeyComparer) { _lock = new NetHttpApplicationStateLock(); _applicationStaticObjects = applicationStaticObjects; if (_applicationStaticObjects == null) { _applicationStaticObjects = new HttpStaticObjectsCollection(); } _sessionStaticObjects = sessionStaticObjects; if (_sessionStaticObjects == null) { _sessionStaticObjects = new HttpStaticObjectsCollection(); } }
static HttpStaticObjectsCollection MakeStaticCollection(ArrayList list) { if (list == null || list.Count == 0) { return(null); } HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection(); foreach (ObjectTagBuilder tag in list) { coll.Add(tag); } return(coll); }
public void TestData() { // Modification method is internal. var statics = new HttpStaticObjectsCollection(); statics.GetType().GetMethod("Add", BindingFlags.Instance | BindingFlags.NonPublic) .Invoke(statics, new object[] { "int", typeof(int), false }); var data = new IgniteSessionStateStoreData(statics, 44); data.Items["key"] = "val"; Assert.AreEqual(44, data.Timeout); Assert.AreEqual(1, data.StaticObjects.Count); Assert.AreEqual(0, data.StaticObjects["int"]); Assert.AreEqual("val", data.Items["key"]); }
internal HttpApplicationState(HttpStaticObjectsCollection applicationStaticObjects, HttpStaticObjectsCollection sessionStaticObjects) { _applicationStaticObjects = applicationStaticObjects; if (_applicationStaticObjects == null) { _applicationStaticObjects = new HttpStaticObjectsCollection(); } _sessionStaticObjects = sessionStaticObjects; if (_sessionStaticObjects == null) { _sessionStaticObjects = new HttpStaticObjectsCollection(); } }
internal HttpSessionState (string id, SessionDictionary dict, HttpStaticObjectsCollection staticObjects, int timeout, bool newSession, bool isCookieless, SessionStateMode mode, bool isReadonly) { _id = id; _dict = dict; _staticObjects = staticObjects.Clone (); _timeout = timeout; _newSession = newSession; _isCookieless = isCookieless; _mode = mode; _isReadonly = isReadonly; }
public MySessionState(string id, ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout, bool newSession, HttpCookieMode cookieMode, SessionStateMode mode, bool isReadonly) { pId = id; pSessionItems = sessionItems; pStaticObjects = staticObjects; pTimeout = timeout; pNewSession = newSession; pCookieMode = cookieMode; pMode = mode; pIsReadonly = isReadonly; }
internal static HttpStaticObjectsCollection FromByteArray(byte [] data) { HttpStaticObjectsCollection objs = null; MemoryStream stream = null; try { stream = new MemoryStream(data); objs = Deserialize(new BinaryReader(stream)); } catch { throw; } finally { if (stream != null) { stream.Close(); } } return(objs); }
internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection coll = new HttpStaticObjectsCollection(); if (objects == null) { return(coll); } var collObjects = coll.Objects; foreach (var de in objects) { StaticItem item = new StaticItem((StaticItem)de.Value); collObjects [de.Key] = item; } return(coll); }
public ServletSessionStateItemCollection () {} // For Java deserialization public ServletSessionStateItemCollection (HttpContext context) : this () { _items = new SessionStateItemCollection (); _staticObjects = new HttpStaticObjectsCollection (); if (context != null) { ServletContext servletContext = J2EEUtils.GetWorkerRequest (context).GetContext (); string sessionPersistance = servletContext.getInitParameter (J2EEConsts.Enable_Session_Persistency); if (sessionPersistance != null) { try { _needSessionPersistence = Boolean.Parse (sessionPersistance); } catch (Exception) { _needSessionPersistence = false; Debug.WriteLine ("EnableSessionPersistency init param's value is invalid. the value is " + sessionPersistance); } } } }
internal HttpSessionStateContainer( SessionStateModule stateModule, string id, ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout, bool newSession, HttpCookieMode cookieMode, SessionStateMode mode, bool isReadonly) { _stateModule = stateModule; _id = id; // If null, it means we're delaying session id reading _sessionItems = sessionItems; _staticObjects = staticObjects; _timeout = timeout; _newSession = newSession; _cookieMode = cookieMode; _mode = mode; _isReadonly = isReadonly; }
internal HttpApplicationState (HttpStaticObjectsCollection AppObj, HttpStaticObjectsCollection SessionObj) { if (null != AppObj) { _AppObjects = AppObj; } else { _AppObjects = new HttpStaticObjectsCollection (); } if (null != SessionObj) { _SessionObjects = SessionObj; } else { _SessionObjects = new HttpStaticObjectsCollection (); } _Lock = new ReaderWriterLock (); }
public static HttpSessionState GetMockHttpSessionState() { HttpSessionState state = null; HttpStaticObjectsCollection staticObjects = new HttpStaticObjectsCollection(); SessionStateItemCollection itemCollection = new SessionStateItemCollection(); IHttpSessionState sessionStateContainer = new HttpSessionStateContainer(Guid.NewGuid().ToString("N"), itemCollection, staticObjects, 1, true, HttpCookieMode.UseUri, SessionStateMode.InProc, false); state = Activator.CreateInstance( typeof(HttpSessionState), BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, new object[] { sessionStateContainer }, CultureInfo.CurrentCulture) as HttpSessionState; return state; }
public static HttpStaticObjectsCollection Deserialize(BinaryReader reader) { HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection(); int num = reader.ReadInt32(); while (num-- > 0) { HttpStaticObjectsEntry entry; string name = reader.ReadString(); if (reader.ReadBoolean()) { object instance = AltSerialization.ReadValueFromStream(reader); entry = new HttpStaticObjectsEntry(name, instance, 0); } else { string typeName = reader.ReadString(); bool lateBound = reader.ReadBoolean(); entry = new HttpStaticObjectsEntry(name, Type.GetType(typeName), lateBound); } objectss._objects.Add(name, entry); } return objectss; }
public static HttpStaticObjectsCollection Deserialize(BinaryReader reader) { HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection(); int num = reader.ReadInt32(); while (num-- > 0) { HttpStaticObjectsEntry entry; string name = reader.ReadString(); if (reader.ReadBoolean()) { object instance = AltSerialization.ReadValueFromStream(reader); entry = new HttpStaticObjectsEntry(name, instance, 0); } else { string typeName = reader.ReadString(); bool lateBound = reader.ReadBoolean(); entry = new HttpStaticObjectsEntry(name, Type.GetType(typeName), lateBound); } objectss._objects.Add(name, entry); } return(objectss); }
internal HttpApplicationState(HttpStaticObjectsCollection AppObj, HttpStaticObjectsCollection SessionObj) { if (null != AppObj) { _AppObjects = AppObj; } else { // do not use the public (empty) ctor as it required UnmanagedCode permission _AppObjects = new HttpStaticObjectsCollection(this); } if (null != SessionObj) { _SessionObjects = SessionObj; } else { // do not use the public (empty) ctor as it required UnmanagedCode permission _SessionObjects = new HttpStaticObjectsCollection(this); } _Lock = new ReaderWriterLock(); }
internal HttpApplicationState (HttpStaticObjectsCollection AppObj, HttpStaticObjectsCollection SessionObj) { if (null != AppObj) { _AppObjects = AppObj; } else { // do not use the public (empty) ctor as it required UnmanagedCode permission _AppObjects = new HttpStaticObjectsCollection (this); } if (null != SessionObj) { _SessionObjects = SessionObj; } else { // do not use the public (empty) ctor as it required UnmanagedCode permission _SessionObjects = new HttpStaticObjectsCollection (this); } _Lock = new ReaderWriterLock (); }
internal InProcSessionState(ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout, bool locked, DateTime utcLockDate, int lockCookie, int flags) { this.Copy(sessionItems, staticObjects, timeout, locked, utcLockDate, lockCookie, flags); }
SessionStateStoreData GetItemInternal (HttpContext context, string id, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actions, bool exclusive) { locked = false; lockAge = TimeSpan.MinValue; lockId = Int32.MinValue; actions = SessionStateActions.None; if (id == null) return null; StateServerItem item = stateServer.GetItem (id, out locked, out lockAge, out lockId, out actions, exclusive); if (item == null) return null; if (actions == SessionStateActions.InitializeItem) return CreateNewStoreData (context, item.Timeout); SessionStateItemCollection items = null; HttpStaticObjectsCollection sobjs = null; MemoryStream stream = null; BinaryReader reader = null; Stream input = null; #if NET_4_0 GZipStream gzip = null; #endif try { if (item.CollectionData != null && item.CollectionData.Length > 0) { stream = new MemoryStream (item.CollectionData); #if NET_4_0 if (config.CompressionEnabled) input = gzip = new GZipStream (stream, CompressionMode.Decompress, true); else #endif input = stream; reader = new BinaryReader (input); items = SessionStateItemCollection.Deserialize (reader); #if NET_4_0 if (gzip != null) gzip.Close (); #endif reader.Close (); } else items = new SessionStateItemCollection (); if (item.StaticObjectsData != null && item.StaticObjectsData.Length > 0) sobjs = HttpStaticObjectsCollection.FromByteArray (item.StaticObjectsData); else sobjs = new HttpStaticObjectsCollection (); } catch (Exception ex) { throw new HttpException ("Failed to retrieve session state.", ex); } finally { if (stream != null) stream.Dispose (); #if NET_4_0 if (reader != null) reader.Dispose (); if (gzip != null) gzip.Dispose (); #else if (reader != null) ((IDisposable)reader).Dispose (); #endif } return new SessionStateStoreData (items, sobjs, item.Timeout); }
public HttpStaticObjectsCollectionWrapper(HttpStaticObjectsCollection httpStaticObjectsCollection) { }
internal HttpApplicationState(HttpStaticObjectsCollection AppObj, HttpStaticObjectsCollection SessionObj) { _AppObjects = AppObj; _SessionObjects = SessionObj; _Lock = new ReaderWriterLockSlim(); }
internal void Copy(ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout) { this._sessionItems = sessionItems; this._staticObjects = staticObjects; this._timeout = timeout; }
internal RedisSessionState(ISessionStateItemCollection sessionItems, HttpStaticObjectsCollection staticObjects, int timeout) { this.Copy(sessionItems, staticObjects, timeout); }
internal static HttpStaticObjectsCollection Deserialize (BinaryReader r) { HttpStaticObjectsCollection result = new HttpStaticObjectsCollection (); for (int i = r.ReadInt32 (); i > 0; i--) { string key = r.ReadString (); int index = r.ReadInt32 (); if (index == System.Web.Util.AltSerialization.NullIndex) result.Set (key, null); else result.Set (key, System.Web.Util.AltSerialization.DeserializeFromIndex (index, r)); } return result; }
internal HttpApplicationState() { _applicationStaticObjects = new HttpStaticObjectsCollection(); _sessionStaticObjects = new HttpStaticObjectsCollection(); }