Ejemplo n.º 1
0
        public static MobiContext GetCurrent(HttpContext httpContext)
        {
            try
            {
                lock (httpContext.Request)
                {
                    MobiContext mobiContext = httpContext.Items[MobiHttpContextItemKey] as MobiContext;
                    if (mobiContext != null)
                    {
                        return(mobiContext as MobiContext);
                    }

                    mobiContext = new MobiContext(httpContext, ServiceCallbackApplication.GetRuntime(httpContext));
                    httpContext.Items[MobiHttpContextItemKey] = mobiContext;
                    return(mobiContext);
                }
            }
            catch (Exception e)
            {
                MobiContext mobiContext = httpContext.Items[MobiHttpContextItemKey] as MobiContext;
                if (mobiContext != null)
                {
                    return(mobiContext as MobiContext);
                }

                mobiContext = new MobiContext(httpContext, ServiceCallbackApplication.GetRuntime(httpContext));
                httpContext.Items[MobiHttpContextItemKey] = mobiContext;
                return(mobiContext);
            }
        }
Ejemplo n.º 2
0
        protected virtual void Application_PreRequestHandlerExecute(object sender, EventArgs e)
        {
            //IPaywallRuntime runtime = PaywallHttpApplication.GetRuntime(this);
            HttpContext httpContext = HttpContext.Current;

            if (HttpContext.Current.Session == null)
            {
                return;
            }

            //if (HttpContext.Current.Handler == null || HttpContext.Current.Session == null ||
            //		HttpContext.Current.Handler.GetType().IsAssignableFrom(typeof(IRequiresSessionState)))
            //	return;

            MobiContext mobiContext = MobiContext.Current;

            return;
        }