gpt4 book ai didi

c# - ASP.NET 表单例份验证默认重定向 [工作] 和重定向到带查询字符串的请求页面 [不工作]

转载 作者:太空宇宙 更新时间:2023-11-03 14:34:08 27 4
gpt4 key购买 nike

我有一个网站,基本的 Forms Authentication 工作正常。用户的电子邮件包含指向我的网站的链接,带有查询字符串变量。提示用户正确登录,但使用

FormsAuthentication.RedirectFromLoginPage(userName, false);

当原始 url 包含查询字符串时不起作用。

我已经尝试过这些请求,但没有被记录:

http://localhost/default.aspx          -- redirect to login, then back to default OK
This is the loaded URL before login:
http://localhost/login.aspx

http://localhost/TaskDetail.aspx -- redirect to login, then back to default FAIL
This is the loaded URL before login:
http://localhost/login.aspx?ReturnUrl=%2ftaskdetail.aspx

http://localhost/TaskDetail.aspx?id=5 -- redirect to login, then back to default FAIL
This is the loaded URL before login:
http://localhost/login.aspx?ReturnUrl=%2fTaskDetail.aspx%3fTaskID%3d2464&TaskID=2464

非常感谢任何帮助。

最佳答案

不幸的是,这是设计使然,但这里有一篇关于这个问题的很棒的文章描述了它,还有一个解决方法:

http://blogs.msdn.com/vijaysk/archive/2008/01/24/anatomy-of-forms-authentication-return-url.aspx

编辑:抱歉,我第一次阅读该博客时还以为有解决方法。尝试对 FormsAuthentication.GetRedirectURL() 执行 Response.Redirect 并添加正确的查询字符串。

关于c# - ASP.NET 表单例份验证默认重定向 [工作] 和重定向到带查询字符串的请求页面 [不工作],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1718743/

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