Just use ASP.net validator controls.
For the password textboxes, use the CompareValidator control.
From MSDN:
Compares the value entered by the user in an input control with the value entered in another input control, or with a constant value.
You'd need something along the lines of:
<asp:textbox ID="Textbox1" runat="server" TextMode="Password"></asp:textbox>
<asp:textbox ID="Textbox2" runat="server" TextMode="Password"></asp:textbox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="No Match." ControlToValidate="Textbox1" ControlToCompare="Textbox2"></asp:CompareValidator>
For the username textbox you could use a Custom Validator control.
You'll need something along the lines of:
ASPX Page
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Invalid User Name" ControlToValidate="TextBox3"
OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
Code Behind
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
bool userNameIsValid = true; // Database check here.
if (userNameIsValid)
args.IsValid = true
else
args.IsValid = false;
}
Here's a tutorial on MSDN which describes using this control to validate user input against a database.