In the standard default new website in VS2012, the Account section Login.aspx has a button to send the login information. There is no event code for that, it apparently runs "Login" which is the CommandName. Where is the code that processes that? Can it be added to or altered? I cannot find it it anywhere in the project. How does the Login actually happen?
1 Answer
The login button is within a <asp:Login /> web control. The <asp:Login /> control will use the default MembershipProvider set in web.config (or machine.config)...or you can set the MembershipProvider property on the Login control
How to: Use the ASP.NET Membership Provider
To control/alter the login logic you can create a custom MembershipProvider that override's the ValidateUser method.
2 Comments
dinotom
more informative than most, thank you. so the validate user method is what actually runs when that button is clicked? so i can create a method that adds logic to that process ?
MikeM
ValidateUser is called when the login control's button w/CommandName="Login" is clicked, yes. To control the ValidateUser logic (not add, but replace) create a custom MembershipProvider class (like this sample one) and you can control the whole process. Also once you've created the custom MembershipProvider you'll update the web.config to include it as the default provider (all of that is outlined in the "How to" link in the answer.