HostHeader based federation - Request Headers are not initialized when FederationConfigurationCreated event fires RRS feed

  • Question

  • User1250099448 posted

    Hi there, I have an almost working solution, that is thwarted by a lack of data initialization, hope someone can help

    We want to have a single instance of an ASP.NET website on the disk

    but multiple Host headers mapping to the site. The idea is that the Css and images maybe different for each one, but the application is the same



    The asp.net site is .NET 4.5 with claims based authentication

    thus in the web.config we have <identityConfiguration and <federationConfiguration settings that we would want to configure differently for each host header.

    (each instance may have it's own trusted issuer, but certainly the realm and reply parameters have to change so that the Identity provider can return to the correct site !)

    The Web.config schema allows for multiple <identityConfiguration and <federationConfiguration as long as there is one set that is unnamed (as default) and each additional

    set has it's own name= attribute. .NET federation ignores the named ones, and loads the default.

    I wrote an httpModule - that adds a handler to FederationConfigurationCreated event  (the only event that seems related to the federation authentication)

    When this fires, I want to see if the loaded FederationConfiguration has the same name as the current host ( HttpContext.Current.Request.Headers("Host") )

    and if not, load the section with that host name

           If e.FederationConfiguration.Name <> lsCurrentHost Then
              e.FederationConfiguration = New System.IdentityModel.Services.Configuration.FederationConfiguration(lsCurrentHost)
              e.FederationConfiguration.IdentityConfiguration = New System.IdentityModel.Configuration.IdentityConfiguration(lsCurrentHost)
           End If

    The problem is the Host is always

    all the Request.Headers are blank or uninitialized

    e.g. ALL_HTTP=""

    Is there a better approach ?

    how can I get the current.Request headers initialized properly ?

    Friday, November 7, 2014 10:57 AM

All replies