【发布时间】:2014-08-07 16:21:52
【问题描述】:
我们最近将解决方案更新为 .NET 4.5。
我正在尝试使用以前在 System.Web.Security 中的“MembershipUser”类。根据我的阅读,它已移至 System.Web.ApplicationServices。我们的解决方案有许多 C# 项目和 2 个网站。所以我右键单击有问题的网站,转到“添加引用”,转到程序集 > 框架,然后单击 System.Web.ApplicationServices 旁边的复选框。它将以下行添加到我的 Web.Config:
<add assembly="System.Web.ApplicationServices, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
好的,太好了。然后我转到我需要在其中使用 MembershipUser 的页面,而 MembershipUser 仍然出错(找不到类型或命名空间)。所以我再次右键单击该站点以确保我已正确添加引用,并且 System.Web.ApplicationServices 旁边没有检查。
所以它在 Web.Config 中,我可以在 Using 语句中调用它,但我无法注册 MembershipUser 类。
我在尝试添加此参考时是否遗漏了什么?
【问题讨论】:
-
It adds the following line to my Web.Config:我想你忘记了那行。 :) -
我在 the documentation 的命名空间中看不到
MembershipUser。 -
@Jashaszun 谢谢你,当我走出办公室时,我意识到这一点。
-
@mason 你是对的,该页面没有列出它。但是离开这个参考link 说 MembershipUser 已经从 System.Web 移动到 System.Web.ApplicationServices。
-
@mason - 它不在 System.Web.ApplicationServices 命名空间中,它在 System.Web.ApplicationServices 程序集中,仍在 System.Web.Security 命名空间中,只是在不同的程序集中。
标签: c# asp.net visual-studio-2012 asp.net-4.5