在旧的webform 未编译的网站项目中使用esclude
的管道中有nancy.Owin
aspx页面的方法?
当我配置 nancy 后回复并且请求是一个aspx页面时,后备文章会被删除,因为 nancy 会将其删除并调用该页面。
public void NancyConfig(IAppBuilder app)
{
app.UseNancy(options =>
{
options.Bootstrapper = new MyBootstrapper();
options.PerformPassThrough = (context => context.Response.StatusCode == HttpStatusCode.NotFound);
});
app.UseStageMarker(PipelineStage.MapHandler);
}
options.PerformPassThrough
擦除回发内容并调用该页面。因为没有回发是好的,但是在后期详细说明中,这呈现出无限循环。
如何配置NancyFx
在passtrought选项中不擦除回发?
答案 0 :(得分:6)
我已经修改了nancy官方1.4源代码,从.aspx和其他页面从管道中退出,返回请求postback whitouth删除它。 您可以尝试修改here。
这里是要在第82行申请的代码:
//Check if the webform is not present inthe path ".aspx"
//if present move to next
if (owinRequestPath.ToLowerInvariant().Contains(".aspx")
|| owinRequestPath.ToLowerInvariant().Contains(".asmx")
|| owinRequestPath.ToLowerInvariant().Contains(".ascx")
|| owinRequestPath.ToLowerInvariant().Contains(".ashx")
|| owinRequestPath.ToLowerInvariant().Contains(".asmx")
|| owinRequestPath.ToLowerInvariant().Contains(".asax")
) return next.Invoke(environment);