public override void Execute(HttpContextBase httpContext) { httpContext.Response.ContentType = ContentType; if (RemoteFileName != null) httpContext.Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + RemoteFileName + "\""); if (FileData != null) httpContext.Response.BinaryWrite(FileData); else httpContext.Response.WriteFile(LocalFileName); }
public override void Execute(HttpContextBase httpContext) { if (_permanent) { httpContext.Response.StatusCode = 301; httpContext.Response.RedirectLocation = _url; } else { httpContext.Response.Redirect(_url); } }
public override void Execute(HttpContextBase httpContext) { try { httpContext.Response.RenderedView = View; httpContext.Response.AppendHeader("X-Powered-By", "ThinkAway MVC v" + WebAppConfig.Version); httpContext.Response.Write(View.Render()); } catch (TemplateNotFoundException templateException) { if (!WebAppConfig.Fire_TemplateNotFound(httpContext.Request.RawUrl)) { httpContext.Response.Write(templateException.Message); } } }
public ContextCreatedEventArgs(OfflineWebSession webSession, HttpContextBase httpContext) { _webSession = webSession; _httpContext = httpContext; }
public void ProcessRequest(HttpContextBase httpContext) { httpContext.Handler = this; string baseUrl = UrlHelper.GetUrlPath(httpContext.Request.AppRelativeCurrentExecutionFilePath, httpContext.Request.PathInfo); Stopwatch stopWatchRun = new Stopwatch(); Stopwatch stopWatchRender = new Stopwatch(); Stopwatch stopWatchTotal = new Stopwatch(); ActionResult actionResult = null; try { try { stopWatchTotal.Start(); try { stopWatchRun.Start(); actionResult = WebAppHelper.RunControllerAction(_controllerAction); } finally { stopWatchRun.Stop(); } if (actionResult != null) { try { stopWatchRender.Start(); actionResult.Execute(httpContext); } finally { stopWatchRender.Stop(); } } } finally { stopWatchTotal.Stop(); if (WebAppConfig.LoggingProvider != null) { WebAppConfig.LoggingProvider.LogPage(WebAppContext.Session.SessionID, baseUrl, GetQueryString(), WebAppContext.Session.LanguageCode, actionResult != null ? actionResult.LayoutName : null, actionResult != null ? actionResult.ViewName : null, (int) stopWatchRun.ElapsedMilliseconds, (int) stopWatchRender.ElapsedMilliseconds, (int) stopWatchTotal.ElapsedMilliseconds); } } } catch (EndResponseException) { // occurs when Response.End() is called from an offline session (unit test) } catch (ThreadAbortException) { throw; // Occurs when Response.End() is called. Rethrow it, because it is handled by the ASP.NET runtime } catch (Exception ex) { if (ex.InnerException is ThreadAbortException) throw ex.InnerException; WebAppConfig.Fire_ExceptionHandler(ex); } }
public override void Execute(HttpContextBase httpContext) { httpContext.Response.ContentType = "application/json"; httpContext.Response.Write(AjaxHelper.GenerateJSONReturnValue(_data)); }
public abstract void Execute(HttpContextBase httpContext);
public override void Execute(HttpContextBase httpContext) { httpContext.Response.ContentType = "text/xml"; httpContext.Response.Write(_xml); }