It worked correctly when I tried. I think the problem is that you use RedirectPermanent in DoLogin, and I'm guessing that you first tried with invalid credentials. Because of the RedirectPermanent, subsequent submits to DoLogin are directly sent by the browser to ProtectedContent so the user is never logged in. You should use RedirectTemporary instead. And make sure that you do a hard refresh (Ctrl+F5) in your browser when testing this fix, to flush the permanent redirect from the browser's cache.

By on 8/30/2016 1:05 AM ()

You're correct, it works correctly in OWIN self hosted template. But It doesn't with Suave template: although the cookie is correctly set by LoginUser(), GetLoggedInUser() always return null with Suave, any idea why? (and RedirectTemporary locks in a redirect loop in case of failed authentication...)

By on 8/30/2016 1:26 AM ()

Ah, indeed with Suave I am having the same issue as you. It must be either a bug in WebSharper.Owin that only manifests when not hosted by Katana (the Microsoft.Owin self-hosting), or in Suave's Owin layer. In fact, it is already a known bug.

and RedirectTemporary locks in a redirect loop in case of failed authentication...

Right, I think it would make more sense to redirect to Login if the login is incorrect, no?

By on 8/30/2016 3:02 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper