ASP.NET Membership 使用-两个重置 SQL 语句

作者:vkvi 来源:千一网络(原创) 日期:2009-8-13

注意:本文的代码请在查询分析器或 SQL Server Management Studio 中执行,不要在 Visual Web Developer 等中执行,因为那样可能会自动改变 SQL 语句的结构,从而改变 SQL 的意义。Membership 支持一个库存储多个应用程序的用户,但一般我们只用了一个应用程序,其名称为“/”。

一、将登录失败次数过多导致被锁的用户解锁

UPDATE aspnet_Membership
SET IsLockedOut = 0, FailedPasswordAttemptCount = 0
FROM aspnet_Membership INNER JOIN
     aspnet_Users ON aspnet_Membership.ApplicationId = aspnet_Users.ApplicationId AND
     aspnet_Membership.UserId = aspnet_Users.UserId AND
     aspnet_Users.UserName = '用户名' INNER JOIN
     aspnet_Applications ON
     aspnet_Membership.ApplicationId = aspnet_Applications.ApplicationId AND
     aspnet_Applications.ApplicationName = '/'

二、将用户密码重置为 12345678

UPDATE aspnet_Membership
SET Password = '4WZR2v0Wyu/biawg2l9ipguDp2Q=', PasswordSalt = 'djDDaMObgd+UPHI+V0lLgA=='
FROM aspnet_Membership INNER JOIN
     aspnet_Users ON aspnet_Membership.ApplicationId = aspnet_Users.ApplicationId AND
     aspnet_Membership.UserId = aspnet_Users.UserId AND
     aspnet_Users.UserName = '用户名' INNER JOIN
     aspnet_Applications ON
     aspnet_Membership.ApplicationId = aspnet_Applications.ApplicationId AND
     aspnet_Applications.ApplicationName = '/'

ASP.NET Membership 密码存储方式有三种:明文、可解密的密文、不可解密的 Hash 密文(默认),本代码适用于“不可解密的 Hash 密文”。

相关阅读

你前面那位网友看了:Visual Studio 类的使用与项目引用的关系

▲▲▲嘿,欢迎转载传播本站原创文章,尽量保留来源噢。▲▲▲

文章评论
赞助商们