A mysql membership and role provider for asp.net 2.0

首先请点这里下载最新的操作MYSQL的程序集以及本文章的源代码:

Download

download the code here.

 

Setup

  1. Get the latest MySQL .NET Connector for .NET v2.0 (make sure you use the binaries for .NET v2.0). Copy the file in your ~/bin folder.
  2. Create the tables. The sql commands may change from a mySQL version to another, these following commands should be compatible with mySQL 4.1.

    # Table: 'roles'

    #

    CREATE

    TABLE `roles` (

    `

    Rolename` varchar(255) collate latin1_general_ci NOT NULL default '',

    `

    ApplicationName` varchar(255) collate latin1_general_ci NOT NULL default '',

     

    )


     

    # Table: 'users'

    #

    CREATE

    TABLE `users` (

    `

    PKID` varchar(36) collate latin1_general_ci NOT NULL default '',

    `

    Username` varchar(255) collate latin1_general_ci NOT NULL default '',

    `

    ApplicationName` varchar(100) collate latin1_general_ci NOT NULL default '',

    `

    Email` varchar(100) collate latin1_general_ci NOT NULL default '',

    `

    Comment` varchar(255) collate latin1_general_ci default NULL,

    `

    Password` varchar(128) collate latin1_general_ci NOT NULL default '',

    `

    PasswordQuestion` varchar(255) collate latin1_general_ci default NULL,

    `

    PasswordAnswer` varchar(255) collate latin1_general_ci default NULL,

    `

    IsApproved` tinyint(1) default NULL,

    `

    LastActivityDate` datetime default NULL,

    `

    LastLoginDate` datetime default NULL,

    `

    LastPasswordChangedDate` datetime default NULL,

    `

    CreationDate` datetime default NULL,

    `

    IsLockedOut` tinyint(1) default NULL,

    `

    LastLockedOutDate` datetime default NULL,

    `

    FailedPasswordAttemptCount` int(11) default NULL,

    `

    FailedPasswordAttemptWindowStart` datetime default NULL,

    `

    FailedPasswordAnswerAttemptCount` int(11) default NULL,

    `

    FailedPasswordAnswerAttemptWindowStart` datetime default NULL,

     

    )

    PRIMARY KEY (`PKID`) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;



    # Table: 'usersinroles'

    #

    CREATE

    TABLE `usersinroles` (

    `

    Username` varchar(255) collate latin1_general_ci NOT NULL default '',

    `

    Rolename` varchar(255) collate latin1_general_ci NOT NULL default '',

    `

    ApplicationName` varchar(255) collate latin1_general_ci NOT NULL default '',

     

    )

    PRIMARY KEY (`Username`,`Rolename`,`ApplicationName`) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
    PRIMARY KEY (`Rolename`,`ApplicationName`) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
  3. Unzip the files to your the root folder of you app.
  4. Configuration : Open and change the web.config file :
    1. Change the connection string : Look for the node <connectionStrings> :  
      • Database : this is the name of the database where you have previously created the tables
      • Data Source : the IP of your mysql server
      • User Id : your mysql username
      • Password : your mysql password
    2. Optional steps :
      • change the value of encryptionKey to a random hexadecimal value of your choice 
      • change the value of applicationName, you have two lines to change, both values should be the same.
  5. Test : load the page /Examples/Default.aspx or /Examples/CreateUser.aspx in your browser
  6. Leave a comment or a bug report under the comments section on this page.
  7. Make a small contribution here or here

Change log

  • MUCH better performance.
  • encryptionKey is now in web.config
  • Bug fix : GetUser() : the reader is now properly closed
  • Bug fix : GetAllUsers() : failed everytime because one parameter was missing
  • Bug fix : FindUsersByEmail(string, int, int, out int) : failed everytime because one parameter was missing
  • event logging removed
    • it was unusable anyway on a shared hosting environnement
    • it's much easier to find a bug when the app throws plain exceptions
  • The distribution is now in a binary (some people did not know what to do with the source files)
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
mysql.data.dll 6.4.4 for .net2.0 是 MySQL 数据库提供的一个用于 .NET Framework 2.0 的 Managed Provider。这个 DLL 文件包含了一些用于在 .NET Framework 应用程序中访问和操作 MySQL 数据库的类和方法。它可以让开发人员利用 .NET 平台的优势来编写强大和可靠的应用程序,同时与 MySQL 数据库进行交互。 mysql.data.dll 6.4.4 版本是较旧的一个版本,支持 .NET Framework 2.0。它适用于那些仍在使用较旧版本的 .NET Framework 的应用程序开发者。这个 DLL 文件可以通过在应用程序中引用它来使用,然后使用其中的类和方法来连接到 MySQL 数据库、执行查询、插入、更新或删除数据等操作。 通过使用 mysql.data.dll,开发人员可以轻松地在 .NET 应用程序中实现与 MySQL 数据库的通信和交互。他们可以使用像 MySqlCommand、MySqlConnection 这样的类来连接到数据库,使用 MySqlCommand 对象来执行 SQL 查询,并通过 MySqlDataReader 对象读取查询结果。开发人员还可以使用 MySqlCommand 对象来执行插入、更新或删除数据的操作。 mysql.data.dll 还提供了其他一些实用的功能,比如事务支持、连接池管理等,以帮助开发人员更好地操作 MySQL 数据库。 总而言之,mysql.data.dll 6.4.4 for .net2.0 是 MySQL 数据库提供的一个用于连接和操作 MySQL 数据库的 .NET Framework 2.0 版本的 DLL 文件。通过使用这个 DLL 文件,开发人员可以方便地在 .NET 应用程序中实现与 MySQL 数据库的交互,并进行各种数据库操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值