开发者

How to use MembershipCreateStatus in a class

开发者 https://www.devze.com 2023-02-16 19:52 出处:网络
I\'m trying to use the .NET membership provider but I don\'t know how. There is my code: using System; using System.Web;

I'm trying to use the .NET membership provider but I don't know how.

There is my code:

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 Crea开发者_开发知识库teUser(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();

And code continues...

My problem is this code returns The type or namespace name "MembershipCreateStatus" could not be found (Are you missing a using directive or an assembly reference?).

How can I fix this?


Add reference to the Assembly System.Web.ApplicationServices. It should do the trick.


Is this .NET 4.0? System.Web in .NET 4.0 does not seem to have this class definition, have you imported it from an earlier version? Edit: removed dumbness, sorry.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号