Пример #1
0
        public void Handle(HttpStatusCode statusCode, NancyContext context)
        {
            var viewLocationContext = new ViewLocationContext();

            viewLocationContext.Context = context;
            context.Response            = _viewFactory.RenderView("_errors/not-found", new object(), viewLocationContext);
        }
 protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
 {
     pipelines.OnError += ((ctx, e) =>
     {
         if (context.Request.Headers.Accept.Any(c => c.Item1.Equals("text/html")))
         {
             IViewFactory viewFactory = container.Resolve <IViewFactory>();
             return(viewFactory.RenderView("Error", new { Message = ex.Message }, new ViewLocationContext()
             {
                 Context = context, ModuleName = "", ModulePath = ""
             }));
         }
     });
 }