Ejemplo n.º 1
0
        internal static void OnPageStart(Object component)
        {
            // has to be in asp compat mode
            if (!IsInAspCompatMode)
            {
                return;
            }

            int rc = UnsafeNativeMethods.AspCompatOnPageStart(component);

            if (rc != 1)
            {
                new HttpException(HttpRuntime.FormatResourceString(SR.Error_onpagestart));
            }

            if (UnsafeNativeMethods.AspCompatIsApartmentComponent(component) != 0)
            {
                Current.RememberStaComponent(component);
            }
        }
Ejemplo n.º 2
0
        internal static bool AnyStaObjectsInSessionState(HttpSessionState session)
        {
            if (session == null)
            {
                return(false);
            }

            int numObjects = session.Count;

            for (int i = 0; i < numObjects; i++)
            {
                Object component = session[i];

                if (component != null && component.GetType().FullName == "System.__ComObject")
                {
                    if (UnsafeNativeMethods.AspCompatIsApartmentComponent(component) != 0)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }