示例#1
0
		public void Dispose ()
		{
			if (rwlock != null) {
				rwlock.Dispose ();
				rwlock = null;
			}
			staticItems = null;
			if (items != null)
				items.Clear ();
			items = null;
		}
示例#2
0
		internal InProcSessionItem ()
		{
			this.locked = false;
			this.cookieless = false;
			this.items = null;
			this.staticItems = null;
			this.lockedTime = DateTime.MinValue;
			this.expiresAt = DateTime.MinValue;
			this.rwlock = new ReaderWriterLockSlim ();
			this.lockId = Int32.MinValue;
			this.timeout = 0;
			this.resettingTimeout = false;
		}
	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 HttpSessionStateContainer (string id,
						  ISessionStateItemCollection sessionItems,
						  HttpStaticObjectsCollection staticObjects,
						  int timeout,
						  bool newSession,
						  HttpCookieMode cookieMode,
						  SessionStateMode mode,
						  bool isReadonly)
		{
			if (id == null)
				throw new ArgumentNullException ("id");
			
			this.sessionItems = sessionItems;
			this.id = id;
			this.staticObjects = staticObjects;
			this.timeout = timeout;
			this.newSession = newSession;
			this.cookieMode = cookieMode;
			this.mode = mode;
			this.isReadOnly = isReadonly;
			this.isCookieless = cookieMode == HttpCookieMode.UseUri;
		}
示例#5
0
    /*
     * Process an Object tag, depending on its scope
     */
    private void ProcessObjectTag(ObjectTagBuilder objectBuilder) {

        ObjectTagScope scope = objectBuilder.Scope;
        CheckObjectTagScope(ref scope);

        // Page and AppInstance are treated identically
        if (scope == ObjectTagScope.Page ||
            scope == ObjectTagScope.AppInstance) {
            if (_pageObjectList == null)
                _pageObjectList = new ArrayList();

            _pageObjectList.Add(objectBuilder);
        }
        else if (scope == ObjectTagScope.Session) {
            if (_sessionObjects == null)
                _sessionObjects = new HttpStaticObjectsCollection();

            _sessionObjects.Add(objectBuilder.ID,
                objectBuilder.ObjectType,
                objectBuilder.LateBound);
        }
        else if (scope == ObjectTagScope.Application) {
            if (_applicationObjects == null)
                _applicationObjects = new HttpStaticObjectsCollection();

            _applicationObjects.Add(objectBuilder.ID,
                objectBuilder.ObjectType,
                objectBuilder.LateBound);
        }
        else {
            Debug.Assert(false, "Unexpected scope!");
        }
    }
示例#6
0
		public override void InitializeRequest (HttpContext context)
		{
			staticObjects = HttpApplicationFactory.ApplicationState.SessionObjects.Clone ();
		}
示例#7
0
		public override void EndRequest (HttpContext context)
		{
			if (staticObjects != null) {
				staticObjects.GetObjects ().Clear ();
				staticObjects = null;
			}
		}
    /*
     * Add assembly dependencies for a collection of static objects
     */
    private void AddStaticObjectAssemblyDependencies(HttpStaticObjectsCollection staticObjects) {
        if (staticObjects == null || staticObjects.Objects == null) return;

        IDictionaryEnumerator en = staticObjects.Objects.GetEnumerator();
        while (en.MoveNext()) {
            HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)en.Value;

            AddTypeDependency(entry.ObjectType);
        }
    }
 public SessionStateStoreData(ISessionStateItemCollection sessionItems,
                             HttpStaticObjectsCollection staticObjects,
                             int timeout) {
     _sessionItems = sessionItems;
     _staticObjects = staticObjects;
     _timeout = timeout;
 }
示例#10
0
        internal void InitStateStoreItem(bool addToContext) {
            Debug.Assert(_rqId != null || s_allowInProcOptimization, "_rqId != null || s_allowInProcOptimization");

            ChangeImpersonation(_rqContext, false);
            try {

                if (_rqItem == null) {
                    Debug.Trace("InitStateStoreItem", "Creating new session state");
                    _rqItem = _store.CreateNewStoreData(_rqContext, s_timeout);
                }

                _rqSessionItems = _rqItem.Items;
                if (_rqSessionItems == null) {
                    throw new HttpException(SR.GetString(SR.Null_value_for_SessionStateItemCollection));
                }

                // No check for null because we allow our custom provider to return a null StaticObjects.
                _rqStaticObjects = _rqItem.StaticObjects;

                _rqSessionItems.Dirty = false;

                _rqSessionState = new HttpSessionStateContainer(
                        this,
                        _rqId,            // could be null if we're using InProc optimization
                        _rqSessionItems,
                        _rqStaticObjects,
                        _rqItem.Timeout,
                        _rqIsNewSession,
                        s_configCookieless,
                        s_configMode,
                        _rqReadonly);

                if (addToContext) {
                    SessionStateUtility.AddHttpSessionStateToContext(_rqContext, _rqSessionState);
                }
            }
            finally {
                RestoreImpersonation();
            }
        }
示例#11
0
        void ResetPerRequestFields() {
            Debug.Assert(_rqIctx == null, "_rqIctx == null");
            Debug.Assert(_rqChangeImpersonationRefCount == 0, "_rqChangeImpersonationRefCount == 0");

            _rqSessionState = null;
            _rqId = null;
            _rqSessionItems = null;
            _rqStaticObjects = null;
            _rqIsNewSession = false;
            _rqSessionStateNotFound = true;
            _rqReadonly = false;
            _rqItem = null;
            _rqContext = null;
            _rqAr = null;
            _rqLockId = null;
            _rqInCallback = 0;
            _rqLastPollCompleted = DateTime.MinValue;
            _rqExecutionTimeout = TimeSpan.Zero;
            _rqAddedCookie = false;
            _rqIdNew = false;
            _rqActionFlags = 0;
            _rqIctx = null;
            _rqChangeImpersonationRefCount = 0;
            _rqTimerThreadImpersonationIctx = null;
            _rqSupportSessionIdReissue = false;
        }