ASP.Net MVC identity infinite redirect loop

社会主义新天地 提交于 2019-12-01 09:28:38

I think your login action is missing [AllowAnonymous] attribute.

Do you have SSL setup locally? Are authenticating on HTTPS then being redirected to HTTP which is killing the cookie & redirecting back to the HTTPS login page

Have you got something in the web.config for forms authentication redirect like

  protection="All" requireSSL="true" loginUrl="~/Account/Login.aspx"

Do your cookies look ok?

Joel Gallagher

Resolved... turns out the culprit was my Unity DI configuration.

I drilled deep to find the errors getting recursively thrown on each redirect, and it suggested the AccountController dependencies weren't being instantiated. I had a similiar issue last year Unity Container trying to resolve non registered type, throwing error , and so I looked further into the changed dependencies.

Following the suggested answer at Register IAuthenticationManager with Unity resolved the issue.

Thanks for the suggestions re: SSL / HTTPS / Filters, investigating these led me to the exceptions.

I also face this same issue before and solve by adding this line in web config

<add key="owin:AutomaticAppStartup" value="false"/>

It will disable OWIN startup discovery.

I hope it will work.

Also check in the IIS virtual directory. Check that anonymous user is enable or not, if disabled then enable it and problem will be solved.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!