ASP.NET窗体身份验证的应用程序跨重定向不工作 [英] ASP.NET forms authentication cross app redirects not working

查看:188
本文介绍了ASP.NET窗体身份验证的应用程序跨重定向不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Web应用程序。结果
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和有enableCrossAp predirects =真。结果
我跟着这篇文章,以获得B发布到A.结果正确RETURNURL
http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433

I have two web applications.
A.Test.Com and B.Test.Com
A.Test.Com has a login page A.Test.Com/Login.aspx. B.Test.Com does not have a login page.
B.Test.Com has the forms loginUrl = A.Test.Com/Login.aspx and B.Test.Com has deny users = ?
Both A & B has the exact same machineKey and have enableCrossAppRedirects = true.
I followed this article to get the correct ReturnUrl sent from B to A.
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(用户,FALSE)。结果
这绝不重定向到B.Te​​st.Com。它只是停留在登录页面上。结果
我也曾尝试的Response.Redirect(FormsAuthentication.GetRedirectUrl(用户,假),真),但不起作用。

When I go to B.Test.Com, I get sent to http://A.Test.Com/Login.aspx?ReturnUrl=http://B.Test.Com
This is correct. Then when I use the login page it calls FormsAuthentication.RedirectFromLoginPage(user,false).
This never redirects to B.Test.Com. It just stays on the login page.
I have also tried Response.Redirect(FormsAuthentication.GetRedirectUrl(user,false),true) but that does not work.

我审查的其他文章。结果
http://w3facility.info/question/forms-authentication-redirect-back-to-original-domain/

<一href=\"http://weblogs.asp.net/dfindley/fix-returnurl-when-sharing-forms-authentication-with-multiple-web-applications\" rel=\"nofollow\">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

<一href=\"http://forums.ext.net/showthread.php?19349-CLOSED-Forms-authentication-RedirectFromLoginPage-not-working\" rel=\"nofollow\">http://forums.ext.net/showthread.php?19349-CLOSED-Forms-authentication-RedirectFromLoginPage-not-working

Other articles I have reviewed.
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

任何帮助将是非常美联社preciated。

Any help would be much appreciated.

编辑 - 结果
所以,我看是怎么回事,但我还是不知道如何解决它。结果
无论A.Test.Com和B.Test.Com需要身份验证。结果
当我去B.Test.Com我重定向到A.Test.Com/Login.aspx因为我未通过身份验证。结果
当我点击登录按钮我重定向到B.Te​​st.Com但站点B不认为我是身份验证,因此重定向我回A.Test.Com/Login.aspx。

EDIT --
So I see what is going on but I still don't know how to solve it.
Both A.Test.Com and B.Test.Com require authentication.
When I go to B.Test.Com I get redirected to A.Test.Com/Login.aspx because I am not authenticated.
Once I click the login button I am redirected to B.Test.Com but site B does not think I am authenticated so it redirects me back to A.Test.Com/Login.aspx.

推荐答案

好吧,我得到它的工作。结果
这确实是一个2部分的问题。结果
首先,我不得不编辑B.Test.Com Global.asax中添加code追加到RETURNURL整个域。结果
http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433

其次,我不得不加入域= Test.Com的形式部分编辑这两个网站窗体身份验证的Web.config。结果
http://msdn.microsoft.com/en-us/library/eb0zx8fc.aspx

Well I got it to work.
This was really a 2 part problem.
First I had to edit B.Test.Com global.asax and add code to append the entire domain to the ReturnUrl.
http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433
Second I had to edit the web.config of both sites for forms authentication by adding domain=Test.Com to the forms section.
http://msdn.microsoft.com/en-us/library/eb0zx8fc.aspx

ADDED链接已经更新:结果
<一href=\"http://www.cnblogs.com/dushouke/archive/2009/03/25/Forms-Authentication-Absolute-ReturnUrl.html\" rel=\"nofollow\">http://www.cnblogs.com/dushouke/archive/2009/03/25/Forms-Authentication-Absolute-ReturnUrl.html

ADDED UPDATED LINKS:
http://www.cnblogs.com/dushouke/archive/2009/03/25/Forms-Authentication-Absolute-ReturnUrl.html

<一个href=\"http://webcache.googleusercontent.com/search?q=cache:http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433\" rel=\"nofollow\">http://webcache.googleusercontent.com/search?q=cache:http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433

<一个href=\"http://web.archive.org/web/20130812232058/http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433\" rel=\"nofollow\">http://web.archive.org/web/20130812232058/http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=cb739183-6a0b-46bc-9179-22aed8e60433

这篇关于ASP.NET窗体身份验证的应用程序跨重定向不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆