诊断登录重定向循环 [英] Diagnosing login redirect loop
问题描述
我的ISP最近有其上的共享IIS托管盒子我的网站上几个权限问题。
My ISP has recently had several permission issues on my site which is hosted on a shared IIS box.
我MVC5应用程序有需要身份验证的默认页面上没有code,但也有地区里面做
My MVC5 application has no code on the default page which requires authentication, but there are areas which do
我已经webpublished我的应用程序的一个子目录测试,目前我得到一个无限重定向循环当我尝试加载任何的[使用AllowAnonymous]页它作为一个结果给404
I have webpublished my application to a subdirectory "test" and I'm currently getting a infinite redirect loop when I try to load any of the [AllowAnonymous] pages which as a result give a 404.
<一个href=\"http://www.mywebsite.co.uk/test/Account/Login?ReturnUrl=%2Ftest%2FAccount%2FLogin%3FReturnUrl%3D%252Ftest%252FAccount%252FLogin%253FReturnUrl%253D%25252Ftest%25252FAccount%25252FLogin%25253FReturnUrl%25253D%2525252Ftest%2525252FAccount%2525252FLogin%2525253FReturnUrl%2525253D%252525252Ftest%252525252FAccount%252525252FLogin%252525253FReturnUrl%252525253D%25252525252Ftest%25252525252FAccount%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252Ftest%2525252525252FAccount%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525252Ftest%252525252525252FAccount%252525252525252FLogin%252525252525253FReturnUrl%252525252525253D%25252525252525252Ftest%25252525252525252FAccount%25252525252525252FLogin%25252525252525253FReturnUrl%25252525252525253D%2525252525252525252Ftest%2525252525252525252FAccount%2525252525252525252FLogin%2525252525252525253FReturnUrl%2525252525252525253D%252525252525252525252Ftest%252525252525252525252FAccount%252525252525252525252FLogin%252525252525252525253FReturnUrl%252525252525252525253D%25252525252525252525252Ftest%25252525252525252525252FAccount%25252525252525252525252FLogin%25252525252525252525253FReturnUrl%25252525252525252525253D%2525252525252525252525252Ftest%2525252525252525252525252FAccount%2525252525252525252525252FLogin%2525252525252525252525253FReturnUrl%2525252525252525252525253D%252525252525252525252525252Ftest%252525252525252525252525252FAccount%252525252525252525252525252FLogin%252525252525252525252525253FReturnUrl%252525252525252525252525253D%25252525252525252525252525252Ftest%25252525252525252525252525252FAccount%25252525252525252525252525252FLogin%25252525252525252525252525253FReturnUrl%25252525252525252525252525253D%2525252525252525252525252525252Ftest%2525252525252525252525252525252FAccount%2525252525252525252525252525252FLogin%2525252525252525252525252525253FReturnUrl%2525252525252525252525252525253D%252525252525252525252525252525252Ftest%252525252525252525252525252525252FAccount%252525252525252525252525252525252FLogin%252525252525252525252525252525253FReturnUrl%252525252525252525252525252525253D%25252525252525252525252525252525252Ftest%25252525252525252525252525252525252Fhome%25252525252525252525252525252525252Ffeedback\" rel=\"nofollow\">http://www.mywebsite.co.uk/test/Account/Login?ReturnUrl=%2Ftest%2FAccount%2FLogin%3FReturnUrl%3D%252Ftest%252FAccount%252FLogin%253FReturnUrl%253D%25252Ftest%25252FAccount%25252FLogin%25253FReturnUrl%25253D%2525252Ftest%2525252FAccount%2525252FLogin%2525253FReturnUrl%2525253D%252525252Ftest%252525252FAccount%252525252FLogin%252525253FReturnUrl%252525253D%25252525252Ftest%25252525252FAccount%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252Ftest%2525252525252FAccount%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525252Ftest%252525252525252FAccount%252525252525252FLogin%252525252525253FReturnUrl%252525252525253D%25252525252525252Ftest%25252525252525252FAccount%25252525252525252FLogin%25252525252525253FReturnUrl%25252525252525253D%2525252525252525252Ftest%2525252525252525252FAccount%2525252525252525252FLogin%2525252525252525253FReturnUrl%2525252525252525253D%252525252525252525252Ftest%252525252525252525252FAccount%252525252525252525252FLogin%252525252525252525253FReturnUrl%252525252525252525253D%25252525252525252525252Ftest%25252525252525252525252FAccount%25252525252525252525252FLogin%25252525252525252525253FReturnUrl%25252525252525252525253D%2525252525252525252525252Ftest%2525252525252525252525252FAccount%2525252525252525252525252FLogin%2525252525252525252525253FReturnUrl%2525252525252525252525253D%252525252525252525252525252Ftest%252525252525252525252525252FAccount%252525252525252525252525252FLogin%252525252525252525252525253FReturnUrl%252525252525252525252525253D%25252525252525252525252525252Ftest%25252525252525252525252525252FAccount%25252525252525252525252525252FLogin%25252525252525252525252525253FReturnUrl%25252525252525252525252525253D%2525252525252525252525252525252Ftest%2525252525252525252525252525252FAccount%2525252525252525252525252525252FLogin%2525252525252525252525252525253FReturnUrl%2525252525252525252525252525253D%252525252525252525252525252525252Ftest%252525252525252525252525252525252FAccount%252525252525252525252525252525252FLogin%252525252525252525252525252525253FReturnUrl%252525252525252525252525252525253D%25252525252525252525252525252525252Ftest%25252525252525252525252525252525252Fhome%25252525252525252525252525252525252Ffeedback
(我认为这是404的查询字符串太长的结果)
(i think this 404 is the result of a query string too long)
如果我webpublish到TEST2相同code ++工程,没有这个问题。
If I webpublish to test2 the "same" code works without this issue.
我试着从本_layout.cshtml项目,看看我是否能发现什么叫造成这一点,但剥离的所有项目从我仍然得到这个错误了。
I've tried removing items from the _layout.cshtml to see if I can spot what call is causing this but after stripping all items out I still get this error.
有没有人有什么我可以用它来诊断问题所在有什么建议?
Does anyone have any suggestions what I can use to diagnose where the problem lies?
推荐答案
通常这是问题,即登录页面不允许未经授权的用户:你死循环 - 未经授权的用户不允许看到的登录页面,所以他重定向到登录页面来获得授权。
Usually that is the problem, that Login page does not allow unauthorized users: you get endless loop - unauthorized user is not allowed to see login page, so he is redirected to login page to get authorization.
因此,在控制器的登录操作要么需要 [使用AllowAnonymous]
属性或添加到web.config中:
So either need [AllowAnonymous]
attribute on your login action in controller or add to web.config:
<location path="/test/account/login">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
这篇关于诊断登录重定向循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!