Example #1
0
        protected internal override void Execute(HttpContextBase httpContext)
        {
            httpContext.Response.StatusCode = _statusCode;

            if (!string.IsNullOrEmpty(_statusMessage))
                httpContext.Response.StatusDescription = _statusMessage;
        }
Example #2
0
 protected internal override void Execute(HttpContextBase httpContext)
 {
     if (_permanent)
     {
         httpContext.Response.RedirectPermanent(_url, false);
     }
     else
     {
         httpContext.Response.Redirect(_url, false);
     }
     
 }
Example #3
0
        protected internal 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);
        }
Example #4
0
 public override void Execute(HttpContextBase httpContext)
 {
     try
     {
         httpContext.Response.RenderedView = View;
         httpContext.Response.AppendHeader("X-Powered-By", "Vici MVC v" + WebAppConfig.Version);
         httpContext.Response.Write(View.Render());
     }
     catch (TemplateNotFoundException templateException)
     {
         if (!WebAppConfig.Fire_TemplateNotFound(httpContext.Request.RawUrl))
         {
             httpContext.Response.Write(templateException.Message);
         }
     }
 }
Example #5
0
        public override void Execute(HttpContextBase httpContext)
        {
            httpContext.Response.ContentType = "application/json";

            httpContext.Response.Write(Json.Stringify(_data,_dateFormat));
        }
Example #6
0
        protected internal override void Execute(HttpContextBase httpContext)
        {
            httpContext.Response.ContentType = _contentType;
            httpContext.Response.ContentEncoding = Encoding.UTF8;
            httpContext.Response.Charset = "utf-8";

            if (_xml != null)
            {
                httpContext.Response.Write(_xml);
            }
            else if (_xDocument != null)
            {
                using (StreamWriter responseStream = new StreamWriter(httpContext.Response.OutputStream))
                {
                    _xDocument.Save(responseStream);
                }
            }
            else if (_xmlDocument != null)
            {
                _xmlDocument.Save(httpContext.Response.OutputStream);
            }
        }
Example #7
0
 protected internal abstract void Execute(HttpContextBase httpContext);
Example #8
0
 public abstract void Execute(HttpContextBase httpContext);
Example #9
0
        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);
            }
        }
Example #10
0
 public ContextCreatedEventArgs(OfflineWebSession webSession, HttpContextBase httpContext)
 {
     _webSession = webSession;
     _httpContext = httpContext;
 }