We can use CompareValidator control to validate the confirmation password to check if both password entered by user is same or not (Generally used to register a user in the website).
Password: <asp:TextBox id="TextBox1" runat="server" TextMode="Password"></asp:TextBox>
Confirm Password: <asp:TextBox id="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
<asp:CompareValidator id="CompareValidator1"
runat="server" ErrorMessage="Passwords do not match!"
ControlToValidate="TextBox2"
ControlToCompare="TextBox1" ></asp:CompareValidator>
In this case if user will not enter same password in both box, the form will not be submitted.