private string RunPage(string url, bool post) { for (; ;) { _redirectedPage = null; _currentPage = url; try { HttpContextBase.CreateContext(this, post ? "POST" : "GET", url, post ? _postData : null); if (ContextCreated != null) { ContextCreated(this, new ContextCreatedEventArgs(this, WebAppContext.HttpContext)); } IHttpRequest httpRequest = WebAppContext.Request; string path = UrlHelper.GetUrlPath(httpRequest.AppRelativeCurrentExecutionFilePath, httpRequest.PathInfo); ControllerAction controllerAction = WebAppHelper.GetControllerAction(path); MvcPageHandler pageHandler = new MvcPageHandler(controllerAction); pageHandler.ProcessRequest(WebAppContext.HttpContext); _isNewSession = false; _view = WebAppContext.HttpContext.Response.RenderedView; } catch (TargetInvocationException ex) { Exception ex2 = ExceptionHelper.ResolveTargetInvocationException(ex); if (!(ex2 is EndResponseException)) { throw ex2; } } catch (EndResponseException) { } _redirectedPage = ((OfflineHttpResponse)WebAppContext.HttpContext.Response).RedirectedUrl; PostData.Clear(); if (!_followRedirects || _redirectedPage == null) { return(WebAppContext.Response.Output); } post = false; url = _redirectedPage; } }
private string RunPage(string url, bool post) { for (; ; ) { _redirectedPage = null; _currentPage = url; try { HttpContextBase.CreateContext(this, post ? "POST" : "GET", url, post ? _postData : null); if (ContextCreated != null) ContextCreated(this, new ContextCreatedEventArgs(this, WebAppContext.HttpContext)); IHttpRequest httpRequest = WebAppContext.Request; string path = UrlHelper.GetUrlPath(httpRequest.AppRelativeCurrentExecutionFilePath, httpRequest.PathInfo); ControllerAction controllerAction = WebAppHelper.GetControllerAction(path); MvcPageHandler pageHandler = new MvcPageHandler(controllerAction); pageHandler.ProcessRequest(WebAppContext.HttpContext); _isNewSession = false; _view = WebAppContext.HttpContext.Response.RenderedView; } catch(TargetInvocationException ex) { Exception ex2 = ExceptionHelper.ResolveTargetInvocationException(ex); if (!(ex2 is EndResponseException)) throw ex2; } catch(EndResponseException) { } _redirectedPage = ((OfflineHttpResponse)WebAppContext.HttpContext.Response).RedirectedUrl; PostData.Clear(); if (!_followRedirects || _redirectedPage == null) return WebAppContext.Response.Output; post = false; url = _redirectedPage; } }
internal PageHandler(MvcPageHandler internalHandler) { _internalHandler = internalHandler; }