如何通过从AD FS 2.0 HomeRealmDiscovery.aspx值FormsSignIn.aspx? [英] How to pass values from AD FS 2.0 HomeRealmDiscovery.aspx to FormsSignIn.aspx?

查看:225
本文介绍了如何通过从AD FS 2.0 HomeRealmDiscovery.aspx值FormsSignIn.aspx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在AD FS 2.0登录页面是一个小ASP.NET Web应用程序(使用.NET 2.0),可定制,以改变它的外表和感觉和功能。 (这样的定制是明确微软记载:请参见登录页面定制及其子页)。

The AD FS 2.0 sign-in pages are a small ASP.NET web application (using .NET 2.0), which can be customized to change the look-and-feel, and the functionality. (Such customization is explicitly documented by Microsoft: see Sign-In Pages Customization and its sub-pages.)

我在有多个家境界'(='声明提供信托)的方案,并在AD FS 2.0使用形式登入(相对于其他的认证处理)。

I have a scenario where there are multiple 'home realms' (= 'Claims Provider Trusts'), and where AD FS 2.0 uses forms sign-in (as opposed to another 'authentication handler').

在页面 HomeRealmDiscovery.aspx 被击中,则该页面应该(通过询问用户如)选择以某种方式家里的境界,然后调用<一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.identityserver.web.ui.homerealmdiscoverypage.selecthomerealm.aspx\"相对=nofollow> SelectHomeRealm()。这通常是在一些ASP.NET事件处理程序做了一些提交按钮。在这一点上的控制转移应用于 FormsSignIn.aspx

When the page HomeRealmDiscovery.aspx is hit, then that page should select a home realm in some way (e.g., by asking the user), and then call SelectHomeRealm(). This is usually done in some ASP.NET event handler for some submit button. At that point control is transferred to the FormsSignIn.aspx page.

现在的FormsSignIn页面上,我想用一些数据(不直接AD FS相关的),它是在HomeRealmDiscovery页面上输入。不过,我看不出有任何获得这些数据的方式。

Now on the FormsSignIn page I would like to use some data (not directly AD FS related) which was entered on the HomeRealmDiscovery page. However, I see no way of getting to that data.

MSDN的网页。如何:确定如何ASP。 NET的Web页面被调用说明如何找出控制是如何转移。在我来说,我发现在FormsSignIn页的IsPostBack 为假, previousPage 为空,而 IsCallback 是假的。 (另 IsCrossPagePostBack 是假的。)因此,MSDN页面表明FormsSignIn页的使用原始请求调用。但事实并非如此,因为我观察(使用例如拉琴),该控制没有被以任何方式重定向客户端浏览器传送。所以,我希望这是一个服务器转移',这样我就可以使用 previousPage 来获得在HomeRealmDiscovery页面实例。 (我试图用一个cookie,但是,这并不工作,因为浏览器是不是在转移有关。)

MSDN page "How to: Determine How ASP.NET Web Pages Were Invoked" explains how to find out how control was transferred. In my case I find that in the FormsSignIn page IsPostBack is false, PreviousPage is null, and IsCallback is false. (Also IsCrossPagePostBack is false.) Therefore the MSDN page suggests that the FormsSignIn page was invoked using an 'original request'. But that is not the case, since I observe (using e.g. Fiddler) that control is not transferred by redirecting the client browser in any way. So I would expect this to be a 'server transfer', so that I could use PreviousPage to get at the HomeRealmDiscovery page instance. (I tried to use a cookie, but that does not work since the browser is not involved in the transfer.)

所以我的问题是:我怎样才能从AD FS 2.0 HomeRealmDiscovery.aspx页的值传递给它的FormsSignIn.aspx页

Therefore my question is: How can I pass a value from the AD FS 2.0 HomeRealmDiscovery.aspx page to its FormsSignIn.aspx page?

推荐答案

AD FS做一些操作与HTTP请求所以最好的选择,我发现正在使用的HttpContext项目集合共享数据。

AD FS does some manipulation with the HTTP request so the best option I've found is using the HttpContext Items collection to share data.

因此​​,从HomeRealmDiscovery页面,与设置的值:

So from the HomeRealmDiscovery page, set the values with:

var context = HttpContext.Current;

string someValue = "someValue";
ComplexObject someOtherValue = new ComplexObject();

context.Items.Add("key", someValue);
context.Items.Add("key2", someOtherValue);

然后在FormsLoginPage,以获取值:

And then in the FormsLoginPage, get the values with:

var context = HttpContext.Current;

var value = context.Items["key"] as string;
var otherValue = context.Items["key2"] as ComplexObject;

希望这有助于。

这篇关于如何通过从AD FS 2.0 HomeRealmDiscovery.aspx值FormsSignIn.aspx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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