【发布时间】:2014-11-17 19:25:11
【问题描述】:
我有两个网络应用程序。
A.Test.Com 和 B.Test.Com
A.Test.Com 有一个登录页面 A.Test.Com/Login.aspx。 B.Test.Com 没有登录页面。
B.Test.Com 的表单 loginUrl = A.Test.Com/Login.aspx 和 B.Test.Com 拒绝用户 = ?
A 和 B 都具有完全相同的 machineKey,并且 enableCrossAppRedirects = true。
我按照这篇文章获取了从 B 发送到 A 的正确 ReturnUrl。
http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433
当我访问 B.Test.Com 时,我会被发送到 http://A.Test.Com/Login.aspx?ReturnUrl=http://B.Test.Com
这是对的。然后,当我使用登录页面时,它会调用 FormsAuthentication.RedirectFromLoginPage(user,false)。
这永远不会重定向到 B.Test.Com。它只停留在登录页面上。
我也尝试过 Response.Redirect(FormsAuthentication.GetRedirectUrl(user,false),true) 但这不起作用。
我看过的其他文章。
http://w3facility.info/question/forms-authentication-redirect-back-to-original-domain/
http://weblogs.asp.net/dfindley/fix-returnurl-when-sharing-forms-authentication-with-multiple-web-applications
http://forums.asp.net/t/1652342.aspx?+ReturnUrl+and+subdomain+for+single+sign+on
http://forums.ext.net/showthread.php?19349-CLOSED-Forms-authentication-RedirectFromLoginPage-not-working
任何帮助将不胜感激。
编辑 --
所以我知道发生了什么,但我仍然不知道如何解决它。
A.Test.Com 和 B.Test.Com 都需要身份验证。
当我去 B.Test.Com 时,我被重定向到 A.Test.Com/Login.aspx,因为我没有经过身份验证。
单击登录按钮后,我将被重定向到 B.Test.Com,但站点 B 认为我未通过身份验证,因此它将我重定向回 A.Test.Com/Login.aspx。
【问题讨论】: