Add a reference to the System.IdentityModel.Tokens DLL

淺唱寂寞╮ 提交于 2019-12-23 13:22:47

问题


How do I add a reference to the System.IdentityModel.Tokens dll?

It does not seem to come up in the Nuget Package Manager.

Do I need to download the DLL?

I have .Net 4.5 installed.

The following code will not compile without the reference:

SessionSecurityToken sst = e.SessionToken;

回答1:


It does exist on NuGet, and was last published 2013-02-08, so I don't understand why you couldn't find it. Try searching for System.IdentityModel.Tokens.ValidatingIssuerNameRegistry. The best way is to install it is using the NuGet packet manager.

You can find the package here: https://www.nuget.org/packages/System.IdentityModel.Tokens.ValidatingIssuerNameRegistry/4.5.0




回答2:


In your solution, right click the References folder and choose "Add Reference"

From the Assemblies->Framework (.NET 4.5) list, select (check) System.IdentityModel and the press ok.

Add the using statement to the top of your class - using System.IdentityModel.Tokens;




回答3:


In case it helps someone else.

Depending on what class you need you may also need reference to

System.IdentityModel.Tokens.ValidatingIssuerNameRegistry.dll

This may not be obvious as it may be implicitly required by specific element in web.config file and not explicitly required in code.



来源:https://stackoverflow.com/questions/19797557/add-a-reference-to-the-system-identitymodel-tokens-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!