Tuesday, January 23, 2018

Use Nancy whit Owin and WebForms

Leave a Comment

There is a method for esclude aspx page from pipeline in the use nancy.Owin in a old webform site project not compiled?

When I configure nancy the post-back and the request is an aspx page the post-back is deleted because nancy delete it and recall the page.

public void NancyConfig(IAppBuilder app) {     app.UseNancy(options =>     {         options.Bootstrapper = new MyBootstrapper();         options.PerformPassThrough = (context => context.Response.StatusCode == HttpStatusCode.NotFound);     });      app.UseStageMarker(PipelineStage.MapHandler); } 

The options.PerformPassThrough wipe the post-back content and call the page. For not post-back is ok but in post-back elaboration this present an infinite loop.

How to configure NancyFx for not wipe post-back in passtrought option?

1 Answers

Answers 1

I'have modified the nancy official 1.4 sources to esclude from .aspx and other page from pipeline, returning the request postback whitouth delete it. You can try this modify here .

  • File modified: Nancy/src/Nancy/Owin/NancyMiddleware.cs
  • Here te code to apply at line 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); 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment