.net - How to fix infinite loop with Asp.NET Identity Login using AuthorizeAttribute? -
.net - How to fix infinite loop with Asp.NET Identity Login using AuthorizeAttribute? -
i trying set asp.net identity, , seems set correctly, when place [authorize]
attribute on basecontroller
class, infinite loop redirecting login page. can help me?
note: every controller (including accountcontroller) inherits basecontroller. also, using .net 4.5 , .net mvc5.
try setting [allowanonymous]
attribute in login/register actions, code looks this:
[authorize] public class basecontroller: controller { ... } public class accountcontroller: basecontroller { [allowanonymous] public actionresult login() { ... } [allowanonymous] [httppost] public actionresult login(loginmodel model, string returnurl) { ... } [allowanonymous] public actionresult register() { ... } [allowanonymous] [httppost] public actionresult register(registermodel model) { ... } ... }
because have added [authorize]
attribute base of operations controller, every action require user authenticated (including login action). however, in order users able authenticate themselves, @ to the lowest degree actions login action should enabled anonymous users. that's accomplish using [allowanonymous]
attribute.
hope helps!
.net asp.net-mvc iis asp.net-identity
Comments
Post a Comment