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.)
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’).
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.
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 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.)
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 does some manipulation with the HTTP request so the best option I’ve found is using the HttpContext Items collection to share data.
So from the HomeRealmDiscovery page, set the values with:
And then in the FormsLoginPage, get the values with:
Hope this helps.