Moving From Owin Katana To IIS

178 views Asked by At

I have an app.Run() statement in Owin Katana. After it is finished running, I want to return to MVC, but not sure how.

app.Run(context =>
{
    if (!ClaimsPrincipal.Current.Identity.IsAuthenticated)
{
    context.Authentication.Challenge(new AuthenticationProperties
    {    RedirectUri = "http://domain.com" }, "Microsoft");
         context.Set<int>("owin.ResponseStatusCode", 401);
         return context.Response.WriteAsync("Redirecting...");
    }
    return Task.FromResult(context);
    });
}

The server doesn't respond to the next incoming request. Rather every authenticated request is blank. It's like it's stuck in the middleware, and doesn't see the MVC controller.

0

There are 0 answers