gpt4 book ai didi

ASP.Net MVC 标识无限重定向循环

转载 作者:行者123 更新时间:2023-12-01 07:36:56 24 4
gpt4 key购买 nike

我有一个 ASP.Net MVC5 应用程序,使用身份“开箱即用”模板,根据 ASP.Net Identity 2.0.0。我需要升级它以使用最新的 ASP.Net MVC 模板中的更新代码,即使用 SignInManager 类。

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

但是,我遇到了一个奇怪的错误,我怀疑与 OWIN 有关。当我尝试登录或注册时,它会触发一个重定向循环,最终导致应用程序崩溃并发出安全警告,因为 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

详细错误信息:

模块 请求过滤模块

通知 开始请求

经办人 ExtensionlessUrlHandler-Integrated-4.0

错误代码 0x00000000

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

在大多数情况下,我的应用程序的原始 AccountController 和相关的安全代码与原始模板没有任何关系。
我较新的示例应用程序在我的本地机器上运行良好,所以我不确定差异在哪里。

我看到帖子暗示 IIS Express 配置是罪魁祸首,但我遵循了清理建议,并且也发布到 Azure 站点,结果相同。

我花了很多时间试图解决这个问题,但没有取得任何成功,所以我想我会把它放在那里寻求一些建议……在此先感谢所有帮助。如果您需要查看更多代码,请告诉我。

最佳答案

我认为您的登录操作丢失了[AllowAnonymous]属性。

关于ASP.Net MVC 标识无限重定向循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30365318/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com