当前位置 : 主页 > 网络编程 > ASP >

ASP.Net MVC身份无限重定向循环

来源:互联网 收集:自由互联 发布时间:2021-06-24
我有一个ASP.Net MVC5应用程序,使用身份“开箱即用”模板,根据ASP.Net Identity 2.0.0.我需要升级它以使用最新的ASP.Net MVC模板中的新代码,即使用SignInManager类. 我在原始应用程序中的代码与最新
我有一个ASP.Net MVC5应用程序,使用身份“开箱即用”模板,根据ASP.Net Identity 2.0.0.我需要升级它以使用最新的ASP.Net MVC模板中的新代码,即使用SignInManager类.

我在原始应用程序中的代码与最新生成的模板之间进行了一些A | B比较,并移植了所有我可以看到的不同之处.

但是,我得到一个奇怪的错误,我怀疑OWIN有关.当我尝试登录或注册时,它会触发一个Redirect循环,最终会使用安全警告崩溃应用程序,因为URL查询字符串已连接到死亡状态.

URL是:
https://localhost:44302/Account/Login?ReturnUrl=%2FAccount%2FLogin%3FReturnUrl%3D%252FAccount%252FLogin%253FReturnUrl%253D%25252FAccount%25252FLogin%25253FReturnUrl%25253D%2525252FAccount%2525252FLogin%2525253FReturnUrl%2525253D%252525252FAccount%252525252FLogin%252525253FReturnUrl%252525253D%25252525252FAccount%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252FAccount%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525252FAccount%252525252525252FLogin%252525252525253FReturnUrl%252525252525253D%25252525252525252FAccount%25252525252525252FLogin%25252525252525253FReturnUrl%25252525252525253D%2525252525252525252FAccount%2525252525252525252FLogin%2525252525252525253FReturnUrl%2525252525252525253D%252525252525252525252FAccount%252525252525252525252FLogin%252525252525252525253FReturnUrl%252525252525252525253D%25252525252525252525252FAccount%25252525252525252525252FLogin%25252525252525252525253FReturnUrl%25252525252525252525253D%2525252525252525252525252FAccount%2525252525252525252525252FLogin%2525252525252525252525253FReturnUrl%2525252525252525252525253D%252525252525252525252525252FAccount%252525252525252525252525252FLogin%252525252525252525252525253FReturnUrl%252525252525252525252525253D%25252525252525252525252525252FAccount%25252525252525252525252525252FLogin%25252525252525252525252525253FReturnUrl%25252525252525252525252525253D%2525252525252525252525252525252FAccount%2525252525252525252525252525252FLogin%2525252525252525252525252525253FReturnUrl%2525252525252525252525252525253D%252525252525252525252525252525252FAccount%252525252525252525252525252525252FLogin%252525252525252525252525252525253FReturnUrl%252525252525252525252525252525253D%25252525252525252525252525252525252FAccount%25252525252525252525252525252525252FLogin%25252525252525252525252525252525253FReturnUrl%25252525252525252525252525252525253D%2525252525252525252525252525252525252FAccount%2525252525252525252525252525252525252FLogin%2525252525252525252525252525252525253FReturnUrl%2525252525252525252525252525252525253D%252525252525252525252525252525252525252FAccount%252525252525252525252525252525252525252FLogin

详细错误信息:

模块RequestFilteringModule

通知BeginRequest

Handler ExtensionlessUrlHandler-Integrated-4.0

错误代码0x00000000

在所有方法中引用ReturnUrl时我都使用了完全相同的设置.

在大多数情况下,我的应用程序的原始AccountController和相关的安全代码不受原始模板的影响.
我的新示例应用程序在我的本地计算机上运行正常,所以我不确定它们之间的区别.

我看到过帖子暗示IIS Express配置应该受到指责,但我已经遵循了清理建议,并且也发布到Azure网站,结果相同.

我花了很多时间试图解决这个问题并且没有取得任何成功,所以我想我会把它放在那里寻求一些建议……提前感谢任何&一切都有帮助如果您需要查看更多代码,请与我们联系.

我认为您的登录操作缺少[AllowAnonymous]属性.
网友评论