ASP.NET MVC 4 SimpleMembershipProvider, WebMatrix WebSecurity Login SQL

ASP.NET MVC 4 Membership Overview:

Using SQL Profiler, below is the SQL that is executed when the ASP.NET MVC 4 SimpleMembershipProvider's WebMatrix.WebData.WebSecurity.Login() method is called:

The UserName below (in bold) is dynamic, it represents the UserName parameter passed to the Login() method.

Similarly, the name of the UserId and UserName columns, and the name of the UserProfile table may also be different based on your specific configuration.

exec sp_executesql N'SELECT [UserId] FROM [UserProfile] WHERE (UPPER([UserName]) = @0)',N'@0 nvarchar(25)',@0=N'UserName'

exec sp_executesql N'SELECT COUNT(*) FROM webpages_Membership WHERE (UserId = @0 AND IsConfirmed = 1)',N'@0 int',@0=1

SELECT m.[Password] FROM webpages_Membership m, [UserProfile] u WHERE m.UserId = 1 AND m.UserId = u.[UserId]

exec sp_executesql N'UPDATE webpages_Membership SET PasswordFailuresSinceLastSuccess = 0 WHERE (UserId = @0)',N'@0 int',@0=1

Hope this helps,


Popular posts from this blog

Search iPhone Text Messages with SQLite SQL Query

Use Azure Functions to Execute a SQL Azure Stored Procedure on a Timer

How to Turn Off Microsoft Arc Touch Mouse Scroll Sound Vibration