static void OnBeginRequestWithFlow(object state)
        {
            HostedHttpRequestAsyncResult self = (HostedHttpRequestAsyncResult)state;

            IDisposable hostedThreadContext = null;

            try
            {
                if (self.flowContext)
                {
                    // In AspCompat case, these are the three things that need to be flowed.  See HostedHttpInput.
                    if (self.hostedThreadData != null)
                    {
                        hostedThreadContext = self.hostedThreadData.CreateContext();
                    }
                }

                // In full-trust, this simply calls the delegate.
                AspNetPartialTrustHelpers.PartialTrustInvoke(ContextOnBeginRequest, self);
            }
            finally
            {
                if (hostedThreadContext != null)
                {
                    hostedThreadContext.Dispose();
                }
            }
        }
Example #2
0
        private static void OnBeginRequestWithFlow(object state)
        {
            HostedHttpRequestAsyncResult result = (HostedHttpRequestAsyncResult)state;

            using (IDisposable disposable = null)
            {
                if (result.flowContext && (result.hostedThreadData != null))
                {
                    disposable = result.hostedThreadData.CreateContext();
                }
                AspNetPartialTrustHelpers.PartialTrustInvoke(ContextOnBeginRequest, result);
            }
        }