作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试使用 .NET 成员资格提供程序,但我不知道如何使用。
这是我的代码:
using System;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.Collections.Specialized;
using System.Data.SqlClient;
using System.Web.Security.SqlMembershipProvider;
namespace CustomMembership
{
public class CustomMembership
{
public static void CreateUser(String UserName, String Password, String Email, out MembershipCreateStatus Result)
{
SqlConnection Conn= new SqlConnection(@"Data Source=A-PC\SQLEXPRESS;Initial Catalog=OyunSitesi;User ID=XXX;Password=XXX");
Conn.Open();
SqlCommand CreateUserCommand= new SqlCommand("Inser Into Uyeler (UyeKullaniciAdi,UyeSifre,UyeEposta,UyeGrubu) Values('"+KullaniciAdi+"','"+Sifresi+"','"+EpostaAdresi+"')",Conn);
CreateUserCommand.ExecuteNonQuery();
代码继续......
我的问题是此代码返回找不到类型或命名空间名称“MembershipCreateStatus”(是否缺少 using 指令或程序集引用?)
。
我该如何解决这个问题?
最佳答案
添加对程序集 System.Web.ApplicationServices 的引用。它应该可以解决问题。
关于c# - 如何在类中使用 MembershipCreateStatus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5315127/
我正在尝试使用 .NET 成员资格提供程序,但我不知道如何使用。 这是我的代码: using System; using System.Web; using System.Data; using Sy
我总是得到结果 invalidpassword。我总是为所有用户传递Password="mypassword"。默认 Membership.CreateUser(Constitid, Password
基本上,我想做的是将更多项目添加到与 .NET 打包在一起的基本 MembershipCreateStatus 枚举中。但是,显然您不能像这样进行“部分枚举”: public partial enum
我正在尝试编写一个单元测试来创建一个新用户并验证是否发生了所需的重定向。这是我的 Register 操作,它几乎是来自 VS 模板的现成代码: [HttpPost] public ActionResu
我是一名优秀的程序员,十分优秀!