Why would FederatedAuthentication.WSFederationAuthenticationModule be null in MVC Azure ACS Federated Authentication?

后端 未结 1 1600
孤街浪徒
孤街浪徒 2021-01-14 02:59

I\'m trying to put together FederatedAuthentication with .NET 4.5, MVC 4, and active redirect using a custom server-side login page, using code from this tutorial, and from

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 03:34

    I managed to fix this myself, and since there are a few unanswered questions similar to this on SO, I'll leave the question up and post my own answer.

    The issue is to do with upgrading the MVC application to .NET 4.5. Much of the WIF functionality remains the same (at least on the surface), but the classes have all moved to different assemblies. I fixed my problem following the migration guidelines here: http://msdn.microsoft.com/en-us/library/jj157089.aspx

    The most important thing is to remove old references to the Microsoft.IdentityModel package (v 3.5.0) and make sure they are replaced by similar references to the System.IdentityModel and System.IdentityModel.Services dlls, which should be version 4.0, and come from the GAC rather than an external package.

    My steps to fix were:

    • Clean out all the junk I'd added to Web.Config and start again with a default MVC Config file.
    • Remove the Microsoft.IdentityModel package and de-reference the dll
    • Run the Access and Identity wizard in VS 2012
    • Duplicate the System.IdentityModel.Services.WSFederationAuthenticationModule reference from in
    • Add
    • Compile, test, dance little jig of delight...

    And this got the original WIF3.5 / MVC3 Code Sample working under.NET 4.5

    0 讨论(0)
提交回复
热议问题