Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

It is possible to use OWIN Nancy with Web Forms?

I define Nancy class like this:

public class DefNancy : NancyModule
{
    public DefNancy() : base("/nancy") {
        Get["/"] = _ => {
            var model = new { title = "Hello world" };
            return View["home", model];
        };
    }
}

And in OWIN Startup class:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        var hubConfiguration = new HubConfiguration();
        hubConfiguration.EnableDetailedErrors = true;
        app.MapSignalR(hubConfiguration);

        config = new HttpConfiguration();
        config.MapHttpAttributeRoutes();
        config.Routes.MapHttpRoute("def","api/{Controller}");
        config.Formatters.Remove(config.Formatters.XmlFormatter); 
        app.UseWebApi(config);

        app.UseNancy();
    }
}

But now my *.aspx and another pages return 404 Error.

like image 645
Ascar Avatar asked Jan 17 '14 10:01

Ascar


1 Answers

Use this:

app.UseNancy(options =>
    options.PerformPassThrough = context =>
        context.Response.StatusCode == HttpStatusCode.NotFound);
like image 102
Ascar Avatar answered Nov 12 '22 07:11

Ascar