Microsoft.IdentityModel vs System.IdentityModel

2020-06-08 05:24发布

问题:

I'm working on a claims-based authorization system using Forms Authentication and ASP.NET MVC 2. I see that one namespace "Microsoft.IdentityModel" provides a lot of the same things as the other "System.IdentityModel".

System.IdentityModel

Microsoft.IdentityModel

Why do these 2 namespaces exist seperately, when the functionality appears to overlap?

回答1:

If you are using Claims Based authentication/authorization, then you will need to use Microsoft.IdentityModel as that is part of the Windows Identity Framework.

For guidance around MVC2 and using WIF I would recommend checking out the work that Patterns and Practices did. They have a decent MVC sample that I used as a starting point.



回答2:

Microsoft.IdentityModel is used by WIF in .NET 4.0 and version before. System.IdentityModel is to be used in .NET 4.5 and beyond. More details here http://msdn.microsoft.com/en-us/library/jj157091.aspx