private HttpApplication GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
        {
            HttpApplication app = null;

            lock (_specialFreeList) {
                if (_numFreeSpecialAppInstances > 0)
                {
                    app = (HttpApplication)_specialFreeList.Pop();
                    _numFreeSpecialAppInstances--;
                }
            }

            if (app == null)
            {
                //
                //  Put the context on the thread, to make it available to anyone calling
                //  HttpContext.Current from the HttpApplication constructor or module Init
                //
                using (new DisposableHttpContextWrapper(context)) {
                    // If ran out of instances, create a new one
                    app = (HttpApplication)HttpRuntime.CreateNonPublicInstance(_theApplicationType);

                    using (new ApplicationImpersonationContext()) {
                        app.InitSpecial(_state, _eventHandlerMethods, appContext, context);
                    }
                }
            }

            return(app);
        }
Exemple #2
0
        private HttpApplication GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
        {
            HttpApplication application = null;

            lock (this._specialFreeList)
            {
                if (this._numFreeSpecialAppInstances > 0)
                {
                    application = (HttpApplication)this._specialFreeList.Pop();
                    this._numFreeSpecialAppInstances--;
                }
            }
            if (application == null)
            {
                using (new DisposableHttpContextWrapper(context))
                {
                    application = (HttpApplication)HttpRuntime.CreateNonPublicInstance(this._theApplicationType);
                    using (new ApplicationImpersonationContext())
                    {
                        application.InitSpecial(this._state, this._eventHandlerMethods, appContext, context);
                    }
                }
            }
            return(application);
        }
Exemple #3
0
        private HttpApplication GetSpecialApplicationInstance()
        {
            HttpApplication app = null;

            lock (_specialFreeList) {
                if (_numFreeSpecialAppInstances > 0)
                {
                    app = (HttpApplication)_specialFreeList.Pop();
                    _numFreeSpecialAppInstances--;
                }
            }

            if (app == null)
            {
                // If ran out of instances, create a new one
                app = (HttpApplication)HttpRuntime.CreateNonPublicInstance(_theApplicationType);
                app.InitSpecial(_state, _eventHandlerMethods);
            }

            return(app);
        }