internal override void WriteReturns(object[] returnValues, Stream outputStream)
        {
            try {
                if (handler != null)
                {
                    Context.Items.Add("wsdls", serverType.ServiceDescriptions);
                    Context.Items.Add("schemas", serverType.Schemas);

                    // conditionally add post-enabled wsdls and schemas to support localhost-only post
                    string localAddr  = Context.Request.ServerVariables["LOCAL_ADDR"];
                    string remoteAddr = Context.Request.ServerVariables["REMOTE_ADDR"];
                    if (Context.Request.Url.IsLoopback || (localAddr != null && remoteAddr != null && localAddr == remoteAddr))
                    {
                        Context.Items.Add("wsdlsWithPost", serverType.ServiceDescriptionsWithPost);
                        Context.Items.Add("schemasWithPost", serverType.SchemasWithPost);
                    }

                    Response.ContentType = "text/html";
                    handler.ProcessRequest(Context);
                }
            }
            catch (Exception e) {
                throw new InvalidOperationException(Res.GetString(Res.HelpGeneratorInternalError), e);
            }
        }
Example #2
0
        // synchronous code
        protected override void VerifyAndProcessRequest(IHttpHandler httpHandler, HttpContextBase httpContext) {
            if (httpHandler == null) {
                throw new ArgumentNullException("httpHandler");
            }

            httpHandler.ProcessRequest(HttpContext.Current);
        }
Example #3
0
        //- @ProcessRequest -//
        public void ProcessRequest(HttpContext context)
        {
            Route(context);
            //+
            List <MinimaComponentSetting.MinimaInfo> parameterList = MinimaComponentSetting.CurrentComponentSetting.GetParameterList();

            MinimaComponentSetting.MinimaInfo currentInfo = parameterList.FirstOrDefault(u => u.WebSection != null && Http.Url.AbsolutePath.ToLower().Contains(u.WebSection.ToLower()));
            if (currentInfo != null)
            {
                context.Items.Add("BlogPage", currentInfo.Page);
            }
            else
            {
                currentInfo = parameterList.FirstOrDefault(u => u.WebSection != null && u.WebSection.Equals("Root", StringComparison.InvariantCultureIgnoreCase));
                if (currentInfo != null)
                {
                    context.Items.Add("BlogPage", currentInfo.Page);
                }
                else
                {
                    context.Items.Add("BlogPage", "~/default.aspx");
                }
            }
            //+
            IHttpHandler h = System.Web.UI.PageParser.GetCompiledPageInstance(ContextItemSet.BlogPage, null, context);

            h.ProcessRequest(context);
        }
Example #4
0
        void NormalPage(HttpContext context)
        {
            IHttpHandler handler = null;

            try
            {
                handler = PageParser.GetCompiledPageInstance(
                    context.Request.Path,
                    context.Request.PhysicalPath, context);
                context.Handler = handler;
                handler.ProcessRequest(context);
            }
            catch (System.Threading.ThreadAbortException) { }
            catch (Exception ex)
            {
                context.Response.Write(ex.ToString());
            }
            finally
            {
                if (handler != null)
                {
                    if (handler is IDisposable)
                    {
                        ((IDisposable)handler).Dispose();
                    }
                }
            }
        }
Example #5
0
 private static void HandleRequestThread(HttpListenerContext context)
 {
     try
     {
         foreach (var httpHandlerObj in HttpHandlers)
         {
             IHttpHandler httpHandler = httpHandlerObj as IHttpHandler;
             httpHandler.ProcessRequest(context);
         }
     }
     catch (HttpException exception)
     {
         ExceptionHelper.RespondError(context.Response, exception);
     }
     catch (Exception exception)
     {
         ExceptionHelper.RespondError(context.Response, exception);
     }
     finally
     {
         if (context != null)
         {
             context.Close();
         }
     }
 }
		protected override void VerifyAndProcessRequest(IHttpHandler handler, HttpContextBase context)
		{
			Precondition.Require(handler, () => Error.ArgumentNull("handler"));
			Precondition.Require(context, () => Error.ArgumentNull("context"));

			handler.ProcessRequest(context.Unwrap());
		}
Example #7
0
 protected override void VerifyAndProcessRequest(IHttpHandler httpHandler, HttpContextBase httpContext)
 {
     if (httpHandler == null)
     {
         throw new ArgumentNullException("httpHandler");
     }
     httpHandler.ProcessRequest(HttpContext.Current);
 }
Example #8
0
 public void GetProcessResult()
 {
     foreach (var httpHandlerFactory in _httpHandlerFactories)
     {
         IHttpHandler httpHandler = httpHandlerFactory.GetHttpHandler();
         if (httpHandler.CanAccept(_context.Request))
         {
             httpHandler.ProcessRequest(_context);
         }
     }
 }
 protected override void VerifyAndProcessRequest(IHttpHandler httpHandler, HttpContextBase httpContext)
 {
     if (httpHandler == null) {
         throw new ArgumentNullException("httpHandler");
     }
     var origHttpHandler = httpContext.Handler;
     try {
         httpContext.Handler = httpHandler;
         httpHandler.ProcessRequest(HttpContext.Current);
     } finally {
         httpContext.Handler = origHttpHandler;
     }
 }
 public static string CaptureOutput(this HttpContext ctx, IHttpHandler page)
 {
     var old = ctx.Response.Output;
     try
     {
         var writer = new StringWriter();
         ctx.Response.Output = writer;
         page.ProcessRequest(ctx);
         return writer.ToString();
     }
     finally
     {
         ctx.Response.Output = old;
     }
 }
        public static void ProcessRequest(this IHttpChannel channel, IHttpHandler handler, HttpServerSettings settings)
        {
            var context = new HttpContextImpl(channel, settings);
            var res = context.Response;

            using (res.OutputStream)
            {
                try
                {
                    var app = handler as ExpressApplication;
                    if (app != null)
                    {
                        if (!app.Process(context))
                        {
                            res.StatusCode = (int)HttpStatusCode.NotFound;
                            res.StatusDescription = "Not found";
                            res.ContentType = "text/plain";
                            res.Write("Resource not found!");
                        }

                        res.Flush();
                        res.End();
                    }
                    else
                    {
                        var workerRequest = new HttpWorkerRequestImpl(context, settings);
                        handler.ProcessRequest(new HttpContext(workerRequest));
                        workerRequest.EndOfRequest();
                    }
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e);

                    res.StatusCode = (int)HttpStatusCode.InternalServerError;
                    res.ContentType = "text/plain";
                    res.Write(e.ToString());
                }
            }
        }
 private void ExecuteInternal(IHttpHandler handler, TextWriter writer, bool preserveForm, bool setPreviousPage, VirtualPath path, VirtualPath filePath, string physPath, Exception error, string queryStringOverride)
 {
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     HttpRequest request = this._context.Request;
     HttpResponse response = this._context.Response;
     HttpApplication applicationInstance = this._context.ApplicationInstance;
     HttpValueCollection form = null;
     VirtualPath path2 = null;
     string queryStringText = null;
     TextWriter writer2 = null;
     AspNetSynchronizationContext syncContext = null;
     this.VerifyTransactionFlow(handler);
     this._context.PushTraceContext();
     this._context.SetCurrentHandler(handler);
     bool enabled = this._context.SyncContext.Enabled;
     this._context.SyncContext.Disable();
     try
     {
         try
         {
             this._context.ServerExecuteDepth++;
             path2 = request.SwitchCurrentExecutionFilePath(filePath);
             if (!preserveForm)
             {
                 form = request.SwitchForm(new HttpValueCollection());
                 if (queryStringOverride == null)
                 {
                     queryStringOverride = string.Empty;
                 }
             }
             if (queryStringOverride != null)
             {
                 queryStringText = request.QueryStringText;
                 request.QueryStringText = queryStringOverride;
             }
             if (writer != null)
             {
                 writer2 = response.SwitchWriter(writer);
             }
             Page page = handler as Page;
             if (page != null)
             {
                 if (setPreviousPage)
                 {
                     page.SetPreviousPage(this._context.PreviousHandler as Page);
                 }
                 Page page2 = this._context.Handler as Page;
                 if ((page2 != null) && page2.SmartNavigation)
                 {
                     page.SmartNavigation = true;
                 }
                 if (page is IHttpAsyncHandler)
                 {
                     syncContext = this._context.InstallNewAspNetSynchronizationContext();
                 }
             }
             if (((handler is StaticFileHandler) || (handler is DefaultHttpHandler)) && !DefaultHttpHandler.IsClassicAspRequest(filePath.VirtualPathString))
             {
                 try
                 {
                     response.WriteFile(physPath);
                 }
                 catch
                 {
                     error = new HttpException(0x194, string.Empty);
                 }
             }
             else if (!(handler is Page))
             {
                 error = new HttpException(0x194, string.Empty);
             }
             else
             {
                 if (handler is IHttpAsyncHandler)
                 {
                     bool isInCancellablePeriod = this._context.IsInCancellablePeriod;
                     if (isInCancellablePeriod)
                     {
                         this._context.EndCancellablePeriod();
                     }
                     try
                     {
                         IHttpAsyncHandler handler2 = (IHttpAsyncHandler) handler;
                         IAsyncResult result = handler2.BeginProcessRequest(this._context, null, null);
                         if (!result.IsCompleted)
                         {
                             bool flag3 = false;
                             try
                             {
                                 try
                                 {
                                 }
                                 finally
                                 {
                                     Monitor.Exit(applicationInstance);
                                     flag3 = true;
                                 }
                                 WaitHandle asyncWaitHandle = result.AsyncWaitHandle;
                                 if (asyncWaitHandle == null)
                                 {
                                     goto Label_0210;
                                 }
                                 asyncWaitHandle.WaitOne();
                                 goto Label_0226;
                             Label_020A:
                                 Thread.Sleep(1);
                             Label_0210:
                                 if (!result.IsCompleted)
                                 {
                                     goto Label_020A;
                                 }
                             }
                             finally
                             {
                                 if (flag3)
                                 {
                                     Monitor.Enter(applicationInstance);
                                 }
                             }
                         }
                     Label_0226:
                         try
                         {
                             handler2.EndProcessRequest(result);
                         }
                         catch (Exception exception)
                         {
                             error = exception;
                         }
                         goto Label_0306;
                     }
                     finally
                     {
                         if (isInCancellablePeriod)
                         {
                             this._context.BeginCancellablePeriod();
                         }
                     }
                 }
                 using (new DisposableHttpContextWrapper(this._context))
                 {
                     try
                     {
                         handler.ProcessRequest(this._context);
                     }
                     catch (Exception exception2)
                     {
                         error = exception2;
                     }
                 }
             }
         }
         finally
         {
             this._context.ServerExecuteDepth--;
             this._context.RestoreCurrentHandler();
             if (writer2 != null)
             {
                 response.SwitchWriter(writer2);
             }
             if ((queryStringOverride != null) && (queryStringText != null))
             {
                 request.QueryStringText = queryStringText;
             }
             if (form != null)
             {
                 request.SwitchForm(form);
             }
             request.SwitchCurrentExecutionFilePath(path2);
             if (syncContext != null)
             {
                 this._context.RestoreSavedAspNetSynchronizationContext(syncContext);
             }
             if (enabled)
             {
                 this._context.SyncContext.Enable();
             }
             this._context.PopTraceContext();
         }
     }
     catch
     {
         throw;
     }
 Label_0306:
     if (error == null)
     {
         return;
     }
     if ((error is HttpException) && (((HttpException) error).GetHttpCode() != 500))
     {
         error = null;
     }
     if (path != null)
     {
         throw new HttpException(System.Web.SR.GetString("Error_executing_child_request_for_path", new object[] { path }), error);
     }
     throw new HttpException(System.Web.SR.GetString("Error_executing_child_request_for_handler", new object[] { handler.GetType().ToString() }), error);
 }
Example #13
0
		private void ProcessPage(IController controller, IHttpHandler page, HttpContext httpContext)
		{
			PreSendView(controller, page);

			page.ProcessRequest(httpContext);

			PostSendView(controller, page);
		}
Example #14
0
		internal void Execute (IHttpHandler handler, TextWriter writer, bool preserveForm, string exePath, string queryString, bool isTransfer, bool isInclude)
		{
			// If the target handler is not Page, the transfer must not occur.
			// InTransit == true means we're being called from Transfer
			bool is_static = (handler is StaticFileHandler);
			if (isTransfer && !(handler is Page) && !is_static)
				throw new HttpException ("Transfer is only allowed to .aspx and static files");

			HttpRequest request = context.Request;
			string oldQuery = request.QueryStringRaw;
			if (queryString != null) {
				request.QueryStringRaw = queryString;
			} else if (!preserveForm) {
				request.QueryStringRaw = String.Empty;
			}

			HttpResponse response = context.Response;
			WebROCollection oldForm = request.Form as WebROCollection;
			if (!preserveForm) {
				request.SetForm (new WebROCollection ());
			}

			TextWriter output = writer;
			if (output == null)
			 	output = response.Output;
			
			TextWriter previous = response.SetTextWriter (output);
			string oldExePath = request.CurrentExecutionFilePath;
			bool oldIsInclude = context.IsProcessingInclude;
			try {
				context.PushHandler (handler);
				if (is_static) // Not sure if this should apply to Page too
					request.SetFilePath (exePath);

				request.SetCurrentExePath (exePath);
				context.IsProcessingInclude = isInclude;
				
				if (!(handler is IHttpAsyncHandler)) {
					handler.ProcessRequest (context);
				} else {
					IHttpAsyncHandler asyncHandler = (IHttpAsyncHandler) handler;
					IAsyncResult ar = asyncHandler.BeginProcessRequest (context, null, null);
					WaitHandle asyncWaitHandle = ar != null ? ar.AsyncWaitHandle : null;
					if (asyncWaitHandle != null)
						asyncWaitHandle.WaitOne ();
					asyncHandler.EndProcessRequest (ar);
				}
			} finally {
				if (oldQuery != request.QueryStringRaw) {
					if (oldQuery != null && oldQuery.Length > 0) {
						oldQuery = oldQuery.Substring (1); // Ignore initial '?'
						request.QueryStringRaw = oldQuery; // which is added here.
					} else
						request.QueryStringRaw = String.Empty;
				}
				
				response.SetTextWriter (previous);
				if (!preserveForm)
					request.SetForm (oldForm);

				context.PopHandler ();
				request.SetCurrentExePath (oldExePath);
				context.IsProcessingInclude = oldIsInclude;
			}
		}
Example #15
0
        private void ExecuteInternal(IHttpHandler handler, TextWriter writer, bool preserveForm, bool setPreviousPage,
            VirtualPath path, VirtualPath filePath, string physPath, Exception error, string queryStringOverride) {

            EnsureHasNotTransitionedToWebSocket();

            if (handler == null)
                throw new ArgumentNullException("handler");

            HttpRequest request = _context.Request;
            HttpResponse response = _context.Response;
            HttpApplication app = _context.ApplicationInstance;

            HttpValueCollection savedForm = null;
            VirtualPath savedCurrentExecutionFilePath = null;
            string savedQueryString = null;
            TextWriter savedOutputWriter = null;
            AspNetSynchronizationContextBase savedSyncContext = null;

            // Transaction wouldn't flow into ASPCOMPAT mode -- need to report an error
            VerifyTransactionFlow(handler);

            // create new trace context
            _context.PushTraceContext();

            // set the new handler as the current handler
            _context.SetCurrentHandler(handler);

            // because we call this synchrnously async operations must be disabled
            bool originalSyncContextWasEnabled = _context.SyncContext.Enabled;
            _context.SyncContext.Disable();

            // Execute the handler
            try {
                try {
                    _context.ServerExecuteDepth++;

                    savedCurrentExecutionFilePath = request.SwitchCurrentExecutionFilePath(filePath);

                    if (!preserveForm) {
                        savedForm = request.SwitchForm(new HttpValueCollection());

                        // Clear out the query string, but honor overrides
                        if (queryStringOverride == null)
                            queryStringOverride = String.Empty;
                    }

                    // override query string if requested
                    if (queryStringOverride != null) {
                        savedQueryString = request.QueryStringText;
                        request.QueryStringText = queryStringOverride;
                    }

                    // capture output if requested
                    if (writer != null)
                        savedOutputWriter = response.SwitchWriter(writer);

                    Page targetPage = handler as Page;
                    if (targetPage != null) {
                        if (setPreviousPage) {
                            // Set the previousPage of the new Page as the previous Page
                            targetPage.SetPreviousPage(_context.PreviousHandler as Page);
                        }

                        Page sourcePage = _context.Handler as Page;

#pragma warning disable 0618    // To avoid deprecation warning
                        // If the source page of the transfer has smart nav on,
                        // always do as if the destination has it too (ASURT 97732)
                        if (sourcePage != null && sourcePage.SmartNavigation)
                            targetPage.SmartNavigation = true;
#pragma warning restore 0618

                        // If the target page is async need to save/restore sync context
                        if (targetPage is IHttpAsyncHandler) {
                            savedSyncContext = _context.InstallNewAspNetSynchronizationContext();
                        }
                    }

                    if ((handler is StaticFileHandler || handler is DefaultHttpHandler) &&
                       !DefaultHttpHandler.IsClassicAspRequest(filePath.VirtualPathString)) {
                        // cannot apply static files handler directly
                        // -- it would dump the source of the current page
                        // instead just dump the file content into response
                        try {
                            response.WriteFile(physPath);
                        }
                        catch {
                            // hide the real error as it could be misleading
                            // in case of mismapped requests like /foo.asmx/bar
                            error = new HttpException(404, String.Empty);
                        }
                    }
                    else if (!(handler is Page)) {
                        // disallow anything but pages
                        error = new HttpException(404, String.Empty);
                    }
                    else if (handler is IHttpAsyncHandler) {
                        // Asynchronous handler

                        // suspend cancellable period (don't abort this thread while
                        // we wait for another to finish)
                        bool isCancellable =  _context.IsInCancellablePeriod;
                        if (isCancellable)
                            _context.EndCancellablePeriod();

                        try {
                            IHttpAsyncHandler asyncHandler = (IHttpAsyncHandler)handler;

                            if (!AppSettings.UseTaskFriendlySynchronizationContext) {
                                // Legacy code path: behavior ASP.NET <= 4.0

                                IAsyncResult ar = asyncHandler.BeginProcessRequest(_context, null, null);

                                // wait for completion
                                if (!ar.IsCompleted) {
                                    // suspend app lock while waiting
                                    bool needToRelock = false;

                                    try {
                                        try { }
                                        finally {
                                            _context.SyncContext.DisassociateFromCurrentThread();
                                            needToRelock = true;
                                        }

                                        WaitHandle h = ar.AsyncWaitHandle;

                                        if (h != null) {
                                            h.WaitOne();
                                        }
                                        else {
                                            while (!ar.IsCompleted)
                                                Thread.Sleep(1);
                                        }
                                    }
                                    finally {
                                        if (needToRelock) {
                                            _context.SyncContext.AssociateWithCurrentThread();
                                        }
                                    }
                                }

                                // end the async operation (get error if any)

                                try {
                                    asyncHandler.EndProcessRequest(ar);
                                }
                                catch (Exception e) {
                                    error = e;
                                }
                            }
                            else {
                                // New code path: behavior ASP.NET >= 4.5
                                IAsyncResult ar;
                                bool blockedThread;

                                using (CountdownEvent countdownEvent = new CountdownEvent(1)) {
                                    using (_context.SyncContext.AcquireThreadLock()) {
                                        // Kick off the asynchronous operation
                                        ar = asyncHandler.BeginProcessRequest(_context,
                                           cb: _ => { countdownEvent.Signal(); },
                                           extraData: null);
                                    }

                                    // The callback passed to BeginProcessRequest will signal the CountdownEvent.
                                    // The Wait() method blocks until the callback executes; no-ops if the operation completed synchronously.
                                    blockedThread = !countdownEvent.IsSet;
                                    countdownEvent.Wait();
                                }

                                // end the async operation (get error if any)

                                try {
                                    using (_context.SyncContext.AcquireThreadLock()) {
                                        asyncHandler.EndProcessRequest(ar);
                                    }

                                    // If we blocked the thread, YSOD the request to display a diagnostic message.
                                    if (blockedThread && !_context.SyncContext.AllowAsyncDuringSyncStages) {
                                        throw new InvalidOperationException(SR.GetString(SR.Server_execute_blocked_on_async_handler));
                                    }
                                }
                                catch (Exception e) {
                                    error = e;
                                }
                            }
                        }
                        finally {
                            // resume cancelleable period
                            if (isCancellable)
                                _context.BeginCancellablePeriod();
                        }
                    }
                    else {
                        // Synchronous handler

                        using (new DisposableHttpContextWrapper(_context)) {
                            try {
                                handler.ProcessRequest(_context);
                            }
                            catch (Exception e) {
                                error = e;
                            }
                        }
                    }
                }
                finally {
                    _context.ServerExecuteDepth--;

                    // Restore the handlers;
                    _context.RestoreCurrentHandler();

                    // restore output writer
                    if (savedOutputWriter != null)
                        response.SwitchWriter(savedOutputWriter);

                    // restore overriden query string
                    if (queryStringOverride != null && savedQueryString != null)
                        request.QueryStringText = savedQueryString;

                    if (savedForm != null)
                        request.SwitchForm(savedForm);

                    request.SwitchCurrentExecutionFilePath(savedCurrentExecutionFilePath);

                    if (savedSyncContext != null) {
                        _context.RestoreSavedAspNetSynchronizationContext(savedSyncContext);
                    }

                    if (originalSyncContextWasEnabled) {
                        _context.SyncContext.Enable();
                    }

                    // restore trace context
                    _context.PopTraceContext();
                }
            }
            catch { // Protect against exception filters
                throw;
            }

            // Report any error
            if (error != null) {
                // suppress errors with HTTP codes (for child requests they mislead more than help)
                if (error is HttpException && ((HttpException)error).GetHttpCode() != 500)
                    error = null;

                if (path != null)
                    throw new HttpException(SR.GetString(SR.Error_executing_child_request_for_path, path), error);

                throw new HttpException(SR.GetString(SR.Error_executing_child_request_for_handler, handler.GetType().ToString()), error);
            }
        }
 private static HttpResponse ProcessRequest(IHttpHandler page, TextWriter writer)
 {
     var response = new HttpResponse(writer);
     var context = new HttpContext(HttpContext.Current.Request, response);
     context.SetSessionStateBehavior(SessionStateBehavior.Required);
     page.ProcessRequest(context);
     return response;
 }
		private void ShowDebugInfo(HttpContext context, IHttpHandler handler)
		{
			if( s_IntegratedPipeline == false ) {
				handler.ProcessRequest(context);
			}
			else {
				bool isAfterMapRequestHandler = false;
				try {
					context.RemapHandler(handler);
				}
				catch( InvalidOperationException ) {
					// 在IIS7的集成管线模式下,当前阶段 >= MapRequestHandler 时,会引发这个异常
					isAfterMapRequestHandler = true;
				}

				if( isAfterMapRequestHandler )
					handler.ProcessRequest(context);
			}
						

		}
Example #18
0
			public bool MoveNext () {
				switch (currentYield) {
					case 0: break;
					case 1: goto yield_1;
					case 2: goto yield_2;
					case 3: goto yield_3;
					case 4: goto yield_4;
#if NET_2_0
					case 5: goto yield_5;
#endif
					case 6: goto yield_6;
#if NET_2_0
					case 7: goto yield_7;
#endif
					case 8: goto yield_8;
					case 9: goto yield_9;
#if NET_2_0
					case 10: goto yield_10;
					case 11: goto yield_11;
#endif
					case 12: goto yield_12;
#if NET_2_0
					case 13: goto yield_13;
#endif
					case 14: goto yield_14;
					case 15: goto yield_15;
#if NET_2_0
					case 16: goto yield_16;
#endif
					case 17: goto yield_17;
#if NET_2_0
					case 18: goto yield_18;
#endif
					default: goto yield_19;
				}

				if (_this.stop_processing) {
					//yield return true;
					current = true;
					currentYield = 1;
					return true;
				}
yield_1:
yield_2:
				if (_this.BeginRequest != null) {
					//foreach (bool stop in RunHooks (BeginRequest))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 2;
						currentEnumerator = _this.RunHooks(_this.BeginRequest).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
yield_3:
				if (_this.AuthenticateRequest != null) {
					//foreach (bool stop in RunHooks (AuthenticateRequest))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 3;
						currentEnumerator = _this.RunHooks(_this.AuthenticateRequest).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
yield_4:
				if (_this.DefaultAuthentication != null) {
					//foreach (bool stop in RunHooks (DefaultAuthentication))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 4;
						currentEnumerator = _this.RunHooks(_this.DefaultAuthentication).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}

#if NET_2_0
yield_5:
				if (_this.PostAuthenticateRequest != null) {
					//foreach (bool stop in RunHooks (AuthenticateRequest))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 5;
						currentEnumerator = _this.RunHooks(_this.PostAuthenticateRequest).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
#endif
yield_6:
				if (_this.AuthorizeRequest != null) {
					//foreach (bool stop in RunHooks (AuthorizeRequest))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 6;
						currentEnumerator = _this.RunHooks(_this.AuthorizeRequest).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
#if NET_2_0
yield_7:
				if (_this.PostAuthorizeRequest != null) {
					//foreach (bool stop in RunHooks (PostAuthorizeRequest))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 7;
						currentEnumerator = _this.RunHooks(_this.PostAuthorizeRequest).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
#endif
yield_8:
				if (_this.ResolveRequestCache != null) {
					//foreach (bool stop in RunHooks (ResolveRequestCache))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 8;
						currentEnumerator = _this.RunHooks(_this.ResolveRequestCache).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}

				// Obtain the handler for the request.
				//IHttpHandler handler = null;
				try {
					handler = _this.GetHandler (_this.context);
				} catch (FileNotFoundException fnf){
					if (_this.context.Request.IsLocal)
						_this.ProcessError (new HttpException (404, String.Format ("File not found {0}", fnf.FileName), fnf));
					else
						_this.ProcessError (new HttpException (404, "File not found", fnf));
				} catch (DirectoryNotFoundException dnf){
					_this.ProcessError (new HttpException (404, "Directory not found", dnf));
				} catch (Exception e) {
					_this.ProcessError (e);
				}

				if (_this.stop_processing) {
					//yield return true;
					current = true;
					currentYield = 9;
					return true;
				}
yield_9:
#if NET_2_0
yield_10:
				if (_this.PostResolveRequestCache != null) {
					//foreach (bool stop in RunHooks (PostResolveRequestCache))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 10;
						currentEnumerator = _this.RunHooks(_this.PostResolveRequestCache).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
yield_11:
				if (_this.PostMapRequestHandler != null) {
					//foreach (bool stop in RunHooks (PostMapRequestHandler))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 11;
						currentEnumerator = _this.RunHooks(_this.PostMapRequestHandler).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
			
#endif
yield_12:
				if (_this.AcquireRequestState != null){
					//foreach (bool stop in RunHooks (AcquireRequestState))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 12;
						currentEnumerator = _this.RunHooks(_this.AcquireRequestState).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}

#if NET_2_0
yield_13:
				if (_this.PostAcquireRequestState != null){
					//foreach (bool stop in RunHooks (PostAcquireRequestState))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 13;
						currentEnumerator = _this.RunHooks(_this.PostAcquireRequestState).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
#endif
			
				//
				// From this point on, we need to ensure that we call
				// ReleaseRequestState, so the code below jumps to
				// `release:' to guarantee it rather than yielding.
				//
				if (_this.PreRequestHandlerExecute != null)
					foreach (bool stop in _this.RunHooks (_this.PreRequestHandlerExecute))
						if (stop)
							goto release;
				
				try {
					_this.context.BeginTimeoutPossible ();
					if (handler != null){
						IHttpAsyncHandler async_handler = handler as IHttpAsyncHandler;
					
						if (async_handler != null){
							_this.must_yield = true;
							_this.in_begin = true;
							async_handler.BeginProcessRequest (_this.context, new AsyncCallback(_this.async_handler_complete_cb), handler);
						} else {
							_this.must_yield = false;
							handler.ProcessRequest (_this.context);
						}
					}
				} catch (ThreadAbortException taex){
					object obj = taex.ExceptionState;
					Thread.ResetAbort ();
					_this.stop_processing = true;
					if (obj is StepTimeout)
						_this.ProcessError (new HttpException ("The request timed out."));
				} catch (Exception e){
					_this.ProcessError (e);
				} finally {
					_this.in_begin = false;
					_this.context.EndTimeoutPossible ();
				}
				if (_this.must_yield) {
					//yield return stop_processing;
					current = _this.stop_processing;
					currentYield = 14;
					return true;
				}
				else if (_this.stop_processing)
					goto release;
yield_14:	
				// These are executed after the application has returned
			
				if (_this.PostRequestHandlerExecute != null)
					foreach (bool stop in _this.RunHooks (_this.PostRequestHandlerExecute))
						if (stop)
							goto release;
			
				release:
					if (_this.ReleaseRequestState != null){
						foreach (bool stop in _this.RunHooks (_this.ReleaseRequestState)){
							//
							// Ignore the stop signal while release the state
							//
					
						}
					}
			
				if (_this.stop_processing) {
					//yield return true;
					current = true;
					currentYield = 15;
					return true;
				}
yield_15:
#if NET_2_0
yield_16:
				if (_this.PostReleaseRequestState != null) {
					//foreach (bool stop in RunHooks (PostReleaseRequestState))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 16;
						currentEnumerator = _this.RunHooks(_this.PostReleaseRequestState).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
#endif

				if (_this.context.Error == null)
					_this.context.Response.DoFilter (true);
yield_17:
				if (_this.UpdateRequestCache != null) {
					//foreach (bool stop in RunHooks (UpdateRequestCache))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 17;
						currentEnumerator = _this.RunHooks(_this.UpdateRequestCache).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}

#if NET_2_0
yield_18:
				if (_this.PostUpdateRequestCache != null) {
					//foreach (bool stop in RunHooks (PostUpdateRequestCache))
					//	yield return stop;
					if (currentEnumerator == null) {
						currentYield = 18;
						currentEnumerator = _this.RunHooks(_this.PostUpdateRequestCache).GetEnumerator();
					}
					while (currentEnumerator.MoveNext())
						return true;

					ResetEnumerator();
				}
#endif
				_this.PipelineDone ();
				currentYield = 19;
yield_19:
				return false;
			}