Primary Authentication Raises RouteExecutionEarlyExitException

I am new to Nancy and am now experimenting with Auth. We look forward to the full implementation of forms authentication.

For testing purposes, I have 3 modules.

Another module:

public class OtherModule : NancyModule { public OtherModule() : base() { // Use global, module level authentication. this.RequiresAuthentication(); Get["/other"] = _ => { return "Other"; }; Get["/woot"] = _ => { return "Woot"; }; } } 

The main module:

 public class MainModule : NancyModule { public MainModule() : base() { Get["/yolo"] = _ => { // Use per-route authentication. this.RequiresAuthentication(); return "#YOLO"; }; } } 

AuthModule:

 public class AuthModule : NancyModule { public AuthModule() : base() { Get["/login"] = _ => { return "To proceed, you must authenticate. [show form]"; }; } } 

Now, when I go to /other and / or /woot , I am redirected to /login - as expected. Although, when I go to /yolo , the application throws a Nancy.ErrorHandling.RouteExecutionEarlyExitException , where I suggested that it should redirect me to /login?returnUrl=seeme .

I went through the github form auth source , which describes the behavior of this file . I cannot find significant differences (my Bootstrapper , my IUserMapper , my IUserIdentity ).

Am I using wrong here? Should I try / catch it and prepare the answers accordingly? This is mistake?

I run NancyFX in a self-service environment ( Nancy.Hosting.Self ), without ASP and without OWIN.

+8
authentication c # nancy
source share
1 answer

False warning, false warning.

It was my Visual Studio debugger that just reported an exception.

Of course, as usual, I clicked "Break" and the application crashed. By clicking Continue, you are redirected to the correct page.

+3
source share

All Articles