I'm trying to get my head around using OWIN. I have created two MVC 5 projects. One with authentication using Aspnet.Identity and the other started as an empty project.
I added the following to the emptyp project:
Account controller with a Login action and coresponding view
Startup.cs and another partial Startup.cs with
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "ApplicationCookie",
LoginPath = new PathString("/Account/Login")
});
}
}
I have decorated the About action in the Home controller with the [Authorize] attribute in both projects.
When I run the first project and go to the About screen before logging in it redirects to the login action as expect. When I do the same for the second project I get a "HTTP Error 401.0 - Unauthorized" instead of redirecting.
Any idea what would cause the second one to behave this way?