我正在尝试编写一个简单的Gui来生成随机密码.我试图使用的代码是:
using System.Web.Security;
Password_txtBx.Text = Membership.GeneratePassword(12, 1);
我收到错误:"当前上下文中不存在名称'Membership'"
我已将代码更改为:
Password_txtBx.Text = System.Web.Security.Membership.GeneratePassword(12, 1);
我得到的错误消息是:"命名空间'System.Web'中不存在类型或命名空间'SecurityMembership'(你是否缺少程序集引用?)"
我在上面两个例子中都引用了System.Web.Security.有什么方法可以解决我的问题吗?
添加对System.Web的引用(引用 - > RightClick - > AddReference - > .NET - > System.Web)
现在为System.Web.Security添加一个using(或Imports,如果使用VB)
您可能需要将配置文件更改为.Net(而不是.Net客户端配置文件)
| 归档时间: |
|
| 查看次数: |
8601 次 |
| 最近记录: |