简体   繁体   English

找不到ASP.NET C#的类型或名称空间“ GenericPrincipal”

[英]The type or namespace 'GenericPrincipal' could not be found ASP.NET C#

I'm trying to follow this Role-based security tutorial. 我正在尝试遵循基于角色的安全性教程。

In Global.asax, I am getting the following error: 在Global.asax中,出现以下错误:

片段1

Can anyone tell me how to solve this? 谁能告诉我如何解决这个问题?

Add using System.Security.Principal to the top. using System.Security.Principal添加到顶部。

In Visual Studio 2015 (maybe other versions too), if you see a squiggly line, you can put the cursor over the squiggly line, and then press: Visual Studio 2015中 (可能还有其他版本),如果看到一条弯曲的线,可以将光标放在弯曲的线上,然后按:

CTRL + .

and Visual Studio will show you a bunch of options to fix the issue. 并且Visual Studio将为您显示许多解决此问题的选项。 One option shown for the above case would be to add using System.Security.Principal and you simply select the option. 针对上述情况显示的一个选项是using System.Security.Principal添加,您只需选择该选项即可。 And that will fix it. 这将解决它。 This is a very useful tool and every developer should be aware of it. 这是一个非常有用的工具,每个开发人员都应该意识到这一点。 Of course, you can add the using System.Security.Principal manually too; 当然,您也可以手动添加using System.Security.Principal just by typing it. 只需输入即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到类型或名称空间名称“类型/名称空间”。-Asp.Net-C# - The type or namespace name 'type/namespace' could not be found.. - Asp.Net - C# C#ASP.Net找不到类型或名称空间名称'iAnywhere' - C# ASP.Net The type or namespace name 'iAnywhere' could not be found C#asp.net-找不到类型或名称空间名称“ Helper”(您是否缺少using指令或程序集引用?) - C# asp.net - The type or namespace name 'Helper' could not be found (are you missing a using directive or an assembly reference?) '找不到类型或名称空间名称'BookModel'ASP.NET MVC - 'The type or namespace name 'BookModel' could not be found ASP.NET MVC 在网站asp.net C#中找不到命名空间名称“ icon” - namespace name 'icon' could not be found in website asp.net c# 无法找到类型或命名空间nvarchar - C# - The type or namespace nvarchar could not be found - C# C# - 找不到类型或命名空间 - C# - Type or namespace could not be found C#找不到类型或名称空间Bunifu - C# the type or namespace Bunifu could not found C#:找不到类型或名称空间NativeWifi? - c# : the type or namespace NativeWifi could not be found? ASP.NET C#:无法找到JavascriptSerializer - ASP.NET C#: JavascriptSerializer could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM