如何在类中使用MembershipCreateStatus

Sef*_*efa 4 c# class membership-provider

我正在尝试使用.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();
Run Code Online (Sandbox Code Playgroud)

代码继续......

我的问题是这个代码返回The type or namespace name "MembershipCreateStatus" could not be found (Are you missing a using directive or an assembly reference?).

我怎样才能解决这个问题?

Thi*_*PXP 6

添加对Assembly System.Web.ApplicationServices的引用.它应该做的伎俩.