【发布时间】:2017-01-19 16:56:58
【问题描述】:
是否可以在 NancyModule 之外渲染视图?例如,我希望能够像这样在错误管道中呈现视图:
public class MyBootstrapper: DefaultNancyBootstrapper
{
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")))
{
// Render view using e here
}
});
}
}
【问题讨论】: