c# - 使用 Membership.GetUser() 时发生错误

标签 c# asp.net-mvc-3 c#-4.0

当我使用 Membership.GetUser() 方法并包含 using System.Web.Security; 命名空间时,错误显示

"The type 'System.Web.Security.MembershipUser' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. C:\Raj\Orchard\src\Orchard.Web\Modules\test\Controllers\VideoController.cs"

最佳答案

您需要在 Visual Studio 项目中的 System.Web.ApplicationServices 程序集中执行“添加引用”。请参阅以下链接了解更多信息:How to: Add or Remove References in Visual Studio

To add a reference in Visual C#

In Solution Explorer, right-click the project node and click Add Reference.

In the Add Reference dialog box, select the tab indicating the type of component you want to reference.

Select the components you want to reference, and then click OK.

关于c# - 使用 Membership.GetUser() 时发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10240834/

相关文章:

c# - 如何在 C# 应用程序中使用 *.lib 文件?

java - 无法访问可移植类库中的类

asp.net-mvc-3 - ASP.NET MVC 3 本地化验证消息适用于我的机器,但不适用于服务器

c# - 如何从具有 Array 属性的 Action Method 返回 Json?

sql-server - “字符串或二进制数据将被截断”

C# 数据表 LINQ 动态 row.field<datatype> 需要编码

c# - 动态绑定(bind)到枚举

C# 4.0 反馈

c# - MVC 3 Dropdown 使用 ViewBag 丢失选定的值

javascript - 如何将 javascript 文件转换为 .exe 文件