private void FireSessionOnEnd(HttpSessionState session, Object eventSource, EventArgs eventArgs) { if (_sessionOnEndMethod != null) { HttpApplication app = GetSpecialApplicationInstance(); #if !FEATURE_PAL // FEATURE_PAL does not enable COM if (AspCompatApplicationStep.AnyStaObjectsInSessionState(session) || HttpRuntime.ApartmentThreading) { AspCompatSessionOnEndHelper helper = new AspCompatSessionOnEndHelper(app, session, eventSource, eventArgs); AspCompatApplicationStep.RaiseAspCompatEvent( null, app, session.SessionID, _sessionOnEndEventHandlerAspCompatHelper, helper, EventArgs.Empty); } else { #endif // !FEATURE_PAL app.ProcessSpecialRequest( null, _sessionOnEndMethod, _sessionOnEndParamCount, eventSource, eventArgs, session); #if !FEATURE_PAL // FEATURE_PAL does not enable COM } #endif // !FEATURE_PAL RecycleSpecialApplicationInstance(app); } }
public object CreateObject(Type type) { AspCompatApplicationStep.CheckThreadingModel(type.FullName, type.GUID); object component = Activator.CreateInstance(type); AspCompatApplicationStep.OnPageStart(component); return(component); }
private void FireSessionOnEnd(HttpSessionState session, object eventSource, EventArgs eventArgs) { if (this._sessionOnEndMethod != null) { HttpApplication specialApplicationInstance = this.GetSpecialApplicationInstance(); if (AspCompatApplicationStep.AnyStaObjectsInSessionState(session) || HttpRuntime.ApartmentThreading) { AspCompatSessionOnEndHelper source = new AspCompatSessionOnEndHelper(specialApplicationInstance, session, eventSource, eventArgs); AspCompatApplicationStep.RaiseAspCompatEvent(null, specialApplicationInstance, session.SessionID, this._sessionOnEndEventHandlerAspCompatHelper, source, EventArgs.Empty); } else { specialApplicationInstance.ProcessSpecialRequest(null, this._sessionOnEndMethod, this._sessionOnEndParamCount, eventSource, eventArgs, session); } this.RecycleSpecialApplicationInstance(specialApplicationInstance); } }
private void RaiseOnStart(EventArgs e) { if (this._sessionStartEventHandler != null) { if (HttpRuntime.ApartmentThreading || this._rqContext.InAspCompatMode) { AspCompatApplicationStep.RaiseAspCompatEvent(this._rqContext, this._rqContext.ApplicationInstance, null, this._sessionStartEventHandler, this, e); } else { if (HttpContext.Current == null) { DisposableHttpContextWrapper.SwitchContext(this._rqContext); } this._sessionStartEventHandler(this, e); } } }
public object CreateObjectFromClsid(string clsid) { object component = null; Guid guid = new Guid(clsid); AspCompatApplicationStep.CheckThreadingModel(clsid, guid); try { component = Activator.CreateInstance(Type.GetTypeFromCLSID(guid, null, true)); } catch { } if (component == null) { throw new HttpException(System.Web.SR.GetString("Could_not_create_object_from_clsid", new object[] { clsid })); } AspCompatApplicationStep.OnPageStart(component); return(component); }
public object CreateObject(string progID) { Type typeFromProgID = null; object component = null; try { typeFromProgID = Type.GetTypeFromProgID(progID); } catch { } if (typeFromProgID == null) { throw new HttpException(System.Web.SR.GetString("Could_not_create_object_of_type", new object[] { progID })); } AspCompatApplicationStep.CheckThreadingModel(progID, typeFromProgID.GUID); component = Activator.CreateInstance(typeFromProgID); AspCompatApplicationStep.OnPageStart(component); return(component); }